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