using FastEndpoints; using FrameworkBLL.Formula; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Formula { public class GetSelectListFormula : BaseEndpoint> { private readonly IFormulaBLL _FormulaBLL; public GetSelectListFormula(IFormulaBLL IFormulaBLL) { _FormulaBLL = IFormulaBLL; } public override void Configure() { Post("/Formula/GetSelectListFormula"); AllowAnonymous(); } public record GetSelectListFormulaParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync(GetSelectListFormulaParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _FormulaBLL.GetSelectListFormula(req.FirstNumber, req.MaxResult, req.CriteriaDTO, 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); } } } }