using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.PaymentTerm; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.PaymentTerm { public class DeletePaymentTerm : BaseEndpoint> { private readonly IPaymentTermBLL _PaymentTermBLL; public DeletePaymentTerm(IPaymentTermBLL IPaymentTermBLL) { _PaymentTermBLL = IPaymentTermBLL; } public override void Configure() { Delete("/PaymentTerm/DeletePaymentTerm"); AllowAnonymous(); } public record DeletePaymentTermParameters( [property: FromHeader] string Login, [property: QueryParam] int PaymentTermId ); protected override async Task> ExecuteAsync(DeletePaymentTermParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PaymentTermBLL.DeletePaymentTerm(req.PaymentTermId, 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); } } } }