using FastEndpoints; using FrameworkBLL.PortletVsMenu; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.PortletVsMenu { public class DeletePortletVsMenu : BaseEndpoint> { private readonly IPortletVsMenuBLL _PortletVsMenuBLL; public DeletePortletVsMenu(IPortletVsMenuBLL IPortletVsMenuBLL) { _PortletVsMenuBLL = IPortletVsMenuBLL; } public override void Configure() { Delete("/PortletVsMenu/DeletePortletVsMenu"); AllowAnonymous(); } public record DeletePortletVsMenuParameters( [property: FromHeader] string Login, [property: QueryParam] int PortletId ); protected override async Task> ExecuteAsync(DeletePortletVsMenuParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PortletVsMenuBLL.DeletePortletVsMenu(req.PortletId, 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); } } } }