using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MRPRun; using MMDAL.DTO.MRPRun; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MRPRun { public class UndoMRP : BaseEndpoint> { private readonly IMRPRunBLL _MRPRunBLL; public UndoMRP(IMRPRunBLL mrpRunBLL) { _MRPRunBLL = mrpRunBLL; } public override void Configure() { Post("/MRPRun/UndoMRP"); AllowAnonymous(); } public record UndoMRPParameters( [property: FromHeader] string Login, [property: FromBody] UndoMRPDTO UndoMRPDTO ); protected override async Task> ExecuteAsync( UndoMRPParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _MRPRunBLL.UndoMRP(req.UndoMRPDTO, 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); } } } }