using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Allocation; using MMBLL.Count; using MMSL.EndPoints.Count; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.Allocation { public class GetSelectListLoadFromAllocation : BaseEndpoint> { private readonly IAllocationBLL _AllocationBLL; public GetSelectListLoadFromAllocation(IAllocationBLL AllocationBLL) { _AllocationBLL = AllocationBLL; } public override void Configure() { Post("/Allocation/GetSelectListLoadFromAllocation"); AllowAnonymous(); } public record GetSelectListLoadFromAllocationParameters( [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult, [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetSelectListLoadFromAllocationParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _AllocationBLL.LoadFromAllocationPicklist(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); } } } }