handle error
This commit is contained in:
parent
3ba954ac82
commit
e8c8c92120
@ -134,8 +134,6 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPut("sidebar/{sectionId}/items/{itemId}")]
|
[HttpPut("sidebar/{sectionId}/items/{itemId}")]
|
||||||
public async Task<IActionResult> UpdateMenuItem(Guid sectionId, Guid itemId, [FromBody] MenuItemDto updatedMenuItem)
|
public async Task<IActionResult> UpdateMenuItem(Guid sectionId, Guid itemId, [FromBody] MenuItemDto updatedMenuItem)
|
||||||
{
|
{
|
||||||
@ -231,6 +229,9 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
var loggedUser = await _userHelper.GetCurrentEmployeeAsync();
|
var loggedUser = await _userHelper.GetCurrentEmployeeAsync();
|
||||||
var employeeId = loggedUser.Id;
|
var employeeId = loggedUser.Id;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
var menus = await _sideBarMenuHelper.GetAllMenuSectionsAsync();
|
var menus = await _sideBarMenuHelper.GetAllMenuSectionsAsync();
|
||||||
|
|
||||||
foreach (var menu in menus)
|
foreach (var menu in menus)
|
||||||
@ -297,7 +298,16 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
menu.Items = allowedItems;
|
menu.Items = allowedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(menus);
|
_logger.LogInfo("Fetched Sidebar Menu");
|
||||||
|
return Ok(ApiResponse<object>.SuccessResponse(menus, "SideBar Menu Fetched successfully"));
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
|
||||||
|
_logger.LogError(ex, "Error Occurred while Updating Fetching Menu");
|
||||||
|
return StatusCode(500, ApiResponse<object>.ErrorResponse("Server Error", ex, 500));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user