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