This commit is contained in:
AdisakKanthawilang 2024-09-30 14:45:40 +07:00
parent 47e8290cd2
commit a0cc233846

View file

@ -14,6 +14,8 @@ using System.Net.Http.Headers;
using System.Security.Claims;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Drawing.Printing;
namespace BMA.EHR.Placement.Service.Controllers
{
@ -70,7 +72,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("user")]
public async Task<ActionResult<ResponseObject>> GetListByProfile()
public async Task<ActionResult<ResponseObject>> GetListByProfile(string keyword = "")
{
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
using (var client = new HttpClient())
@ -129,6 +131,23 @@ namespace BMA.EHR.Placement.Service.Controllers
p.IsActive,
})
.ToListAsync();
if (keyword != "")
{
var data = placementTransfers.Where(x =>
(x.OrganizationPositionOld != null && x.OrganizationPositionOld.Contains(keyword)) ||
(x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
(x.PositionNumberOld != null && x.PositionNumberOld.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
(x.Organization != null && x.Organization.Contains(keyword))
)
//.OrderByDescending(x => x.CreatedAt)
// .Skip((page - 1) * pageSize)
// .Take(pageSize)
.ToList();
placementTransfers = data;
}
return Success(placementTransfers);
}
}