using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.EmployeeQualification; using PayRollDAL.DTO.EmployeeQualification; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.EmployeeQualification { public class SaveEmployeeQualification : BaseEndpoint> { private readonly IEmployeeQualificationBLL _EmployeeQualificationBLL; public SaveEmployeeQualification(IEmployeeQualificationBLL EmployeeQualificationBLL) { _EmployeeQualificationBLL = EmployeeQualificationBLL; } public override void Configure() { Post("/EmployeeQualification/SaveEmployeeQualification"); AllowAnonymous(); } public record SaveEmployeeQualificationParameters( [property: FromHeader] string Login, [property: FromBody] EmployeeQualificationDTO EmployeeQualificationDTO ); protected override async Task> ExecuteAsync(SaveEmployeeQualificationParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _EmployeeQualificationBLL.SaveEmployeeQualification(req.EmployeeQualificationDTO, 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); } } } }