using AccountsBLL.ChequeBook; using AccountsDAL.DTO.ChequeBook; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.ChequeBook { public class SaveChequeBook : BaseEndpoint> { private readonly IChequeBookBLL _ChequeBookBLL; public SaveChequeBook(IChequeBookBLL chequeBookBLL) { _ChequeBookBLL = chequeBookBLL; } public override void Configure() { Post("/ChequeBook/SaveChequeBook"); AllowAnonymous(); } public record SaveChequeBookParameters( [property: FromHeader] string Login, [property: FromBody] ChequeBookDTO ChequeBookDTO ); protected override async Task> ExecuteAsync(SaveChequeBookParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _ChequeBookBLL.SaveChequeBook(req.ChequeBookDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.CLIENT_LEVEL, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, LoginDTO, ex.Message, 500); } } } }