fix กรณีเรียกใช้ api มากกว่า 1 เมนู

This commit is contained in:
Bright 2024-09-26 09:16:15 +07:00
parent 0cb940a927
commit f5130a4c3c
2 changed files with 40 additions and 6 deletions

View file

@ -65,10 +65,27 @@ namespace BMA.EHR.Insignia.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetList()
[HttpGet("{path}")]
public async Task<ActionResult<ResponseObject>> GetList(string path)
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_ROUND");
path = path.Trim().ToUpper();
string getPermission = string.Empty;
if (path == "ROUND")
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_ROUND");
}
else if (path == "MANAGE")
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_MANAGE");
}
else if (path == "REPORT")
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_REPORT");
}
else
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_ROUND");
}
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{

View file

@ -1353,10 +1353,27 @@ namespace BMA.EHR.Insignia.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("note")]
public async Task<ActionResult<ResponseObject>> GetListNote()
[HttpGet("note/{path}")]
public async Task<ActionResult<ResponseObject>> GetListNote(string path)
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_RECORD");
path = path.Trim().ToUpper();
string getPermission = string.Empty;
if (path == "RECORD")
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_RECORD");
}
else if (path == "ALLOCATE")
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_ALLOCATE");
}
else if (path == "BORROW")
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_BORROW");
}
else
{
getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_INSIGNIA_RECORD");
}
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{