using AdminBLL.Period; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AdminSL.EndPoints.Period { public class DeletePeriod : BaseEndpoint> { private readonly IPeriodBLL _PeriodBLL; public DeletePeriod(IPeriodBLL IPeriodBLL) { _PeriodBLL = IPeriodBLL; } public override void Configure() { Delete("/Period/DeletePeriod"); AllowAnonymous(); } public record DeletePeriodParameters( [property: FromHeader] string Login, [property: QueryParam] int PeriodId ); protected override async Task> ExecuteAsync(DeletePeriodParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PeriodBLL.DeletePeriod(req.PeriodId, 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); } } } }