using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Lot; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.Lot { // GB4 parity: mms/Lot.svc/LotDetail/SelectList public class GetSelectListLotForLotDetail : BaseEndpoint> { private readonly ILotBLL _LotBLL; public GetSelectListLotForLotDetail(ILotBLL lotBLL) { _LotBLL = lotBLL; } public override void Configure() { Post("/Lot/GetSelectListLotForLotDetail"); AllowAnonymous(); } public record GetSelectListLotForLotDetailParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync(GetSelectListLotForLotDetailParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _LotBLL.GetLotSelectListForQuantity(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); } } } }