diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs index d7c27c6..d047dbf 100644 --- a/Services/PeriodExamService.cs +++ b/Services/PeriodExamService.cs @@ -675,7 +675,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services await _context.SaveChangesAsync(); } - public async Task> GetsCandidateByStatusAsync(string examId, string status, int page = 1, int pageSize = 25) + public async Task GetsCandidateByStatusAsync(string examId, string status, int page = 1, int pageSize = 25) { var periodExam = await _context.PeriodExams.AsQueryable() .Where(x => x.CheckDisability == false) @@ -715,6 +715,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName, }) .ToListAsync(); + var _candidate = await _context.Candidates.AsQueryable() + .Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister") + .CountAsync(); if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null) candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList(); // var i = 0; @@ -724,7 +727,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services // candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result; // i++; // } - return candidate; + return new { data = candidate, total = _candidate }; } else { @@ -757,6 +760,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName, }) .ToListAsync(); + var _candidate = await _context.Candidates.AsQueryable() + .Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister") + .CountAsync(); if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null) candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList(); // var i = 0; @@ -766,7 +772,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services // candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result; // i++; // } - return candidate; + return new { data = candidate, total = _candidate }; } }