using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.PayTaxType; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.PayTaxType { public class UpdatePayTaxType : BaseEndpoint> { private readonly IPayTaxTypeBLL _PayTaxTypeBLL; public UpdatePayTaxType(IPayTaxTypeBLL IPayTaxTypeBLL) { _PayTaxTypeBLL = IPayTaxTypeBLL; } public override void Configure() { Post("/PayTaxType/UpdatePayTaxType"); AllowAnonymous(); } public record UpdatePayTaxTypeParameters( [property: FromHeader] string Login, [property: QueryParam] int PayTaxTypeId, [property: QueryParam] int PeriodId ); protected override async Task> ExecuteAsync(UpdatePayTaxTypeParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PayTaxTypeBLL.UpdatePayTaxType(req.PayTaxTypeId, 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); } } } }