/// <summary> /// Retrieve a paged list of resources /// </summary> /// <param name="filter">Search criteria</param> /// <param name="currentPage">Current page</param> /// <param name="numPerPage">Number of items per page</param> /// <returns>Paged list of matching resources</returns> public PagedList<Resource> GetResources(ResourceFilter filter, int currentPage, int numPerPage) { int totalRecords = 0; List<Resource> resources = _resourceRepository.Search(filter, currentPage, numPerPage, out totalRecords).ToList(); return new PagedList<Resource>(resources, currentPage, numPerPage, totalRecords); }
public ResourceListViewModel Get([FromUri]ResourceListInputModel inputModel) { if (inputModel == null) inputModel = new ResourceListInputModel(); var filter = new ResourceFilter(); _mapper.Map(inputModel, filter); var resources = _resourceService.GetResources(filter, inputModel.CurrentPage, inputModel.NumPerPage); return new ResourceListViewModel(resources); }