using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MaterialAccount; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MaterialAccount { public class GetSelectListMaterialAccount : BaseEndpoint> { private readonly IMaterialAccountBLL _MaterialAccountBLL; public GetSelectListMaterialAccount(IMaterialAccountBLL MaterialAccountBLL) { _MaterialAccountBLL = MaterialAccountBLL; } public override void Configure() { Post("/MaterialAccount/GetSelectListMaterialAccount"); AllowAnonymous(); } public record GetSelectListMaterialAccountParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetSelectListMaterialAccountParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _MaterialAccountBLL.GetSelectListMaterialAccount(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); } } } }