public async Task <PaginationResult <RulesListEntryVm> > Handle(GetRulesListQuery request, CancellationToken cancellationToken) { var query = _dbContext.Rules.AsNoTracking(); int count = await query.CountAsync(cancellationToken); var result = await query .AddPagination(request.PageNumber, request.PageSize) .Select(x => new RulesListEntryVm { Name = x.Name, Id = x.Id, IsActive = x.IsActive }) .ToListAsync(cancellationToken); return(new PaginationResult <RulesListEntryVm> { ResultTotalCount = count, PageNumber = request.PageNumber, PageSize = result.Count, Result = result }); }
public async Task<IActionResult> GetRulesList([FromQuery] GetRulesListQuery query) { return Ok(await _mediator.Send(query)); }
public Task <PaginationResult <RulesListEntryVm> > GetRulesList(GetRulesListQuery query, bool withCache = true) { return(_apiClient.Get <GetRulesListQuery, PaginationResult <RulesListEntryVm> >("Rules/list", query, withCache ? null : _apiClient.NoCacheHeader)); }