using AccountsBLL.CostCenterPattern; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.CostCenterPattern { public class DeleteCostCenterPattern : BaseEndpoint> { private readonly ICostCenterPatternBLL _CostCenterPatternBLL; public DeleteCostCenterPattern(ICostCenterPatternBLL costCenterPatternBLL) { _CostCenterPatternBLL = costCenterPatternBLL; } public override void Configure() { Delete("/CostCenterPattern/DeleteCostCenterPattern"); AllowAnonymous(); } public record DeleteCostCenterPatternParameters( [property: FromHeader] string Login, [property: QueryParam] int CostCenterPatternId ); protected override async Task> ExecuteAsync(DeleteCostCenterPatternParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _CostCenterPatternBLL.DeleteCostCenterPattern(req.CostCenterPatternId, 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); } } } }