using CMSBLL.ContentCategory; using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using System; using System.Threading; using System.Threading.Tasks; using static GB5Shared.GB5Constant.Constant; namespace CMSSL.EndPoints.ContentCategory { public class GetSelectListContentCategory : BaseEndpoint> { private readonly IContentCategoryBLL _contentCategoryBLL; public GetSelectListContentCategory(IContentCategoryBLL contentCategoryBLL) { _contentCategoryBLL = contentCategoryBLL; } public override void Configure() { Post("/ContentCategory/GetSelectListContentCategory"); AllowAnonymous(); } public record GetSelectListContentCategoryParameters([property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult); protected override async Task> ExecuteAsync(GetSelectListContentCategoryParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _contentCategoryBLL.GetSelectListContentCategory(req.FirstNumber, req.MaxResult, req.CriteriaDTO, 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); } } } }