using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Grade; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.Grade { public class GetListGrade : BaseEndpoint> { private readonly IGradeBLL _GradeBLL; public GetListGrade(IGradeBLL GradeBLL) { _GradeBLL = GradeBLL; } public override void Configure() { Post("/Grade/GetListGrade"); AllowAnonymous(); } public record GetListGradeParameters([property: FromHeader] string Login); protected override async Task> ExecuteAsync(GetListGradeParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _GradeBLL.GetGradeList(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); } } } }