using FastEndpoints; using FrameworkBLL.Parameter; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.Parameter { public class GetSelectListParameter : BaseEndpoint> { private readonly IParameterBLL _ParameterBLL; public GetSelectListParameter(IParameterBLL IParameterBLL) { _ParameterBLL = IParameterBLL; } public override void Configure() { Post("/Parameter/GetSelectListParameter"); AllowAnonymous(); } public record GetSelectListParameterParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetSelectListParameterParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _ParameterBLL.GetSelectListParameter(req.CriteriaDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }