Add Paging

This commit is contained in:
Suphonchai Phoonsawat 2023-10-18 13:49:18 +07:00
parent d1ca7e9ab1
commit 9e95fb5572
5 changed files with 7 additions and 7649 deletions

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)
public async Task<IEnumerable<dynamic>> GetsCandidateByStatusAsync(string examId, string status, int page = 1, int pageSize = 25)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.Where(x => x.CheckDisability == false)
@ -691,6 +691,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// .Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister")
.Skip((page - 1) * pageSize)
.Take(pageSize)
.Select(x => new
{
Id = x.Id,
@ -731,6 +733,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// .Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.Status == status)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.Select(x => new
{
Id = x.Id,