using AccountsBLL.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 DeleteTDSCategory : BaseEndpoint> { public readonly ITDSCategoryBLL _TDSCategoryBLL; public DeleteTDSCategory(ITDSCategoryBLL ITDSCategoryBLL) { _TDSCategoryBLL = ITDSCategoryBLL; } public override void Configure() { Delete("/TDSCategory/DeleteTDSCategory"); AllowAnonymous(); } public record DeleteTDSCategoryParameters( [property: FromHeader] string Login, [property: QueryParam] int TDSCategoryId ); protected override async Task> ExecuteAsync(DeleteTDSCategoryParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _TDSCategoryBLL.DeleteTDSCategory(req.TDSCategoryId, 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); } } } }