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