using CostingBLL.CostAnalysis; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace CostingSL.EndPoints.CostAnalysis { public class DeleteCostAnalysis : BaseEndpoint> { private readonly ICostAnalysisBLL _CostAnalysisBLL; public DeleteCostAnalysis(ICostAnalysisBLL ICostAnalysisBLL) { _CostAnalysisBLL = ICostAnalysisBLL; } public override void Configure() { Delete("/CostAnalysis/DeleteCostAnalysis"); AllowAnonymous(); } public record DeleteCostAnalysisParameters( [property: FromHeader] string Login, [property: QueryParam] int CostAnalysisId ); protected override async Task> ExecuteAsync(DeleteCostAnalysisParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _CostAnalysisBLL.DeleteCostAnalysis(req.CostAnalysisId, 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); } } } }