using FastEndpoints; using FrameworkBLL.RoleVsPortlet; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.RoleVsPortlet { public class DeleteRoleVsPortletWithRoleAndPage : BaseEndpoint> { private readonly IRoleVsPortletBLL _RoleVsPortletBLL; public DeleteRoleVsPortletWithRoleAndPage(IRoleVsPortletBLL IRoleVsPortletBLL) { _RoleVsPortletBLL = IRoleVsPortletBLL; } public override void Configure() { Delete("/RoleVsPortlet/DeleteRoleVsPortletWithRoleAndPage"); AllowAnonymous(); } public record DeleteRoleVsPortletWithRoleAndPageParameters( [property: FromHeader] string Login, [property: QueryParam] int RoleId, [property: QueryParam] int PageId ); protected override async Task> ExecuteAsync(DeleteRoleVsPortletWithRoleAndPageParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _RoleVsPortletBLL.DeleteRoleVsPortletWithRoleAndPage(req.RoleId, req.PageId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }