using AdminBLL.BIZTransaction; using AdminDAL.DTO.BIZTransactionType; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AdminSL.EndPoints.BIZTransaction { public class SaveBIZTransaction : BaseEndpoint> { private readonly IBIZTransactionBLL _BIZTransactionBLL; public SaveBIZTransaction(IBIZTransactionBLL BIZTransactionBLL) { _BIZTransactionBLL = BIZTransactionBLL; } public override void Configure() { Post("/BIZTransaction/SaveBIZTransaction"); AllowAnonymous(); } public record SaveBIZTransactionParameters( [property: FromHeader] string Login, [property: FromBody] BIZTransactionDTO BIZTransactionDTO ); protected override async Task> ExecuteAsync(SaveBIZTransactionParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _BIZTransactionBLL.SaveBIZTransaction(req.BIZTransactionDTO, 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); } } } }