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