แก้pagingสมัครสอบ

This commit is contained in:
Kittapath 2023-10-18 20:08:51 +07:00
parent bf21d09189
commit 57a52ef866

View file

@ -675,7 +675,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task<IEnumerable<dynamic>> GetsCandidateByStatusAsync(string examId, string status, int page = 1, int pageSize = 25)
public async Task<dynamic> 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 };
}
}