using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.GradeSpecificationValue; using MMDAL.DTO.GradeSpecificationValue; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.GradeSpecificationValue { public class SaveGradeSpecificationValue : BaseEndpoint> { private readonly IGradeSpecificationValueBLL _GradeSpecificationValueBLL; public SaveGradeSpecificationValue(IGradeSpecificationValueBLL GradeSpecificationValueBLL) { _GradeSpecificationValueBLL = GradeSpecificationValueBLL; } public override void Configure() { Post("/GradeSpecificationValue/SaveGradeSpecificationValue"); AllowAnonymous(); } public record SaveGradeSpecificationValueParameters( [property: FromHeader] string Login, [property: FromBody] GradeSpecificationValueDTO GradeSpecificationValueDTO ); protected override async Task> ExecuteAsync(SaveGradeSpecificationValueParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _GradeSpecificationValueBLL.SaveGradeSpecificationValue(req.GradeSpecificationValueDTO, 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); } } } }