เพิ่ม paging ระบบบรรจุ แต่งตั้ง ย้าย โอน
This commit is contained in:
parent
bb9e79b06c
commit
e59f242427
8 changed files with 152 additions and 15 deletions
|
|
@ -17,6 +17,8 @@ using Microsoft.Extensions.Configuration;
|
|||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Controllers
|
||||
{
|
||||
|
|
@ -90,7 +92,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
|
||||
[HttpGet("exam/{year}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetExam(int year)
|
||||
public async Task<ActionResult<ResponseObject>> GetExam(int year, int page = 1, int pageSize = 10, string keyword = "")
|
||||
{
|
||||
var data = await _context.Placements.Where(x => year > 0 ? (x.Year == year) : (x.Year > 0))
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
|
|
@ -107,9 +109,22 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
AccountEndDate = x.EndDate,
|
||||
AccountExpirationDate = x.EndDate,
|
||||
IsExpired = x.EndDate.Date < DateTime.Now.Date,
|
||||
CreatedAt = x.CreatedAt,
|
||||
}).ToListAsync();
|
||||
if (keyword != "")
|
||||
{
|
||||
var data_ = data.Where(x =>
|
||||
(x.ExamRound != null && x.ExamRound.Contains(keyword)) ||
|
||||
(x.ExamOrder != null && x.ExamOrder.Contains(keyword)) ||
|
||||
(x.NumberOfCandidates != null && x.NumberOfCandidates.ToString().Contains(keyword)))
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(data);
|
||||
data = data_;
|
||||
}
|
||||
return Success( new { data, total = data.Count });
|
||||
}
|
||||
|
||||
[HttpGet("pass/{examId:length(36)}")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue