public IHttpActionResult Get(HelpRequestCategory helpRequestCategory = 0, int page = 1, int pageSize = 15) { var query = _helpRequestService.GetAll(helpRequestCategory); PagingResultVM <HelpRequestsModel> pagingResult = _pagingResultFactory.CreatePagingResultDesc(query, pageSize, page, x => x.RequestDate, GetHelpRequestViewModelSelector()); return(Ok(pagingResult)); }
public IHttpActionResult Get(int page = 1, int pageSize = 20, string searchParameter = null) { var result = _clientService.GetClients(searchParameter); PagingResultVM <ClientModel> pagingResult = _pagingResultFactory.CreatePagingResult(result, pageSize, page, (x) => x.UserLoginData.UserName, GetClientViewModelSelector()); return(Ok(pagingResult)); }
public PagingResultVM <R> CreatePagingResultDesc <R, I, TKey>(IQueryable <I> data, int pageSize, int pageIndex, Func <I, TKey> orderBy, Func <I, R> selector) { PagingResultVM <R> pagingResult = CreatePageResult <I, R>(data, pageSize, pageIndex); pagingResult.Result = data .OrderByDescending(orderBy) .Skip((pageIndex - 1) * pageSize) .Take(pageSize) .Select(selector) .ToList(); return(pagingResult); }