public async Task <PaginatedResult <OrderModel> > GetPage(GetOrderPageQuery search) { var query = _readOnlyRepository.Query <Order>(); if (!string.IsNullOrEmpty(search.Term)) { var term = search.Term.Trim(); query = query.Where(x => x.UserId.Contains(term)); } var sortCriteria = search.GetSortCriteria(); var items = query .ProjectTo <OrderModel>(_mapper.ConfigurationProvider) .OrderByOrDefault(sortCriteria, x => x.UserId); var page = await _paginator.MakePageAsync(_readOnlyRepository, query, items, search); return(page); }
public async Task <IActionResult> GetPage([FromQuery] GetOrderPageQuery query) { var result = await _orderService.GetPage(query); return(Ok(result)); }