using AccountsBLL.TDSCategory; using AccountsDAL.DTO.TDSCategory; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.TDSCategory { public class SaveTDSCategory : BaseEndpoint> { private readonly ITDSCategoryBLL _TDSCategoryBLL; public SaveTDSCategory(ITDSCategoryBLL TDSCategoryBLL) { _TDSCategoryBLL = TDSCategoryBLL; } public override void Configure() { Post("/TDSCategory/SaveTDSCategory"); AllowAnonymous(); } public record SaveTDSCategoryParameters( [property: FromHeader] string Login, [property: FromBody] TDSCategoryDTO TDSCategoryDTO ); protected override async Task> ExecuteAsync(SaveTDSCategoryParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _TDSCategoryBLL.SaveTDSCategory(req.TDSCategoryDTO, 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); } } } }