using FastEndpoints; using FrameworkBLL.Mail; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.Mail { public class GetSelectListMail : BaseEndpoint> { private readonly IMailBLL _MailBLL; public GetSelectListMail(IMailBLL IMailBLL) { _MailBLL = IMailBLL; } public override void Configure() { Post("/Mail/GetSelectListMail"); AllowAnonymous(); } public record GetSelectListMailParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync(GetSelectListMailParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _MailBLL.GetSelectListMail(req.FirstNumber, req.MaxResult, req.CriteriaDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NotRequired, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NotRequired, LoginDTO, ex.Message, 500); } } } }