api จัดรอบการสอบ
This commit is contained in:
parent
44d18ff74c
commit
bd0f02feb1
24 changed files with 8532 additions and 33 deletions
|
|
@ -49,16 +49,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PeriodExam?> GetsExamAndCandidateAsync(string id, bool showAll = true)
|
||||
public async Task<PeriodExam?> GetsExamAndCandidateAsync(string examId, bool showAll = true)
|
||||
{
|
||||
return await _context.PeriodExams.FirstOrDefaultAsync(x => x.Id == Guid.Parse(id));
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
|
||||
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
return periodExam;
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PeriodExam inserted)
|
||||
{
|
||||
var periodExam = new PeriodExam
|
||||
{
|
||||
//xxxxxxxxxxxxxxxxxxxxxxx
|
||||
Name = inserted.Name,
|
||||
StartDate = inserted.StartDate,
|
||||
EndDate = inserted.EndDate,
|
||||
Round = inserted.Round,
|
||||
Fee = inserted.Fee,
|
||||
Year = inserted.Year,
|
||||
Detail = inserted.Detail,
|
||||
AnnounceDate = inserted.AnnounceDate,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
@ -80,7 +93,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxx
|
||||
periodExam.Name = updated.Name;
|
||||
periodExam.StartDate = updated.StartDate;
|
||||
periodExam.EndDate = updated.EndDate;
|
||||
periodExam.Round = updated.Round;
|
||||
periodExam.Fee = updated.Fee;
|
||||
periodExam.Year = updated.Year;
|
||||
periodExam.Detail = updated.Detail;
|
||||
periodExam.AnnounceDate = updated.AnnounceDate;
|
||||
periodExam.IsActive = updated.IsActive;
|
||||
periodExam.LastUpdatedAt = DateTime.Now;
|
||||
periodExam.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -101,6 +121,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Candidate?>> GetsCandidateByStatusAsync(string examId, string status)
|
||||
{
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
|
||||
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
return await _context.Candidates.AsQueryable()
|
||||
.Where(x => x.PeriodExam == periodExam && x.Status == status)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue