public PagedLocations GetAllPages(int itemsPerPage, string orderBy = "", string searchTerm = "", string sortOrder = "ASC") { //var allPages = (PagingCollection<IndexedLocation>)_requestCache.GetCacheItem("paged-locations-search-pages", () => locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper())); var allPages = locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper()); var result = new PagedLocations() { ItemsPerPage = itemsPerPage, TotalItems = allPages.TotalCount, TotalPages = allPages.PagesCount }; var listOfPages = new List <PageOfLocations>(); for (var i = 0; i < allPages.PagesCount; i++) { var page = new PageOfLocations() { Locations = allPages.GetData(i + 1), PageNum = i, ItemsPerPage = allPages.GetCount(i + 1), TotalItems = allPages.TotalCount, TotalPages = allPages.PagesCount }; listOfPages.Add(page); } result.Pages = listOfPages; return(result); }
public PageOfLocations GetAllPaged(long pageNum, long itemsPerPage) { var paged = Repositories.LocationRepo.GetPaged(pageNum + 1, itemsPerPage, string.Empty); var totalCount = Repositories.LocationRepo.GetCount(); var result = new PageOfLocations() { Locations = paged, PageNum = pageNum, ItemsPerPage = itemsPerPage, TotalItems = Convert.ToInt64(totalCount) }; return(result); }
public PageOfLocations GetAllPaged(long pageNum, long itemsPerPage) { var allPages = locationService.GetAllPages(Convert.ToInt32(itemsPerPage), "", ""); var result = new PageOfLocations() { Locations = allPages.GetData(Convert.ToInt32(pageNum + 1)), PageNum = pageNum, ItemsPerPage = itemsPerPage, TotalItems = allPages.TotalCount, TotalPages = allPages.PagesCount }; return(result); }
public PageOfLocations GetAllPaged(int pageNum, int itemsPerPage, string orderBy, string searchTerm = "", string sortOrder = "ASC") { //var allPages = (PagingCollection<IndexedLocation>)_requestCache.GetCacheItem("paged-locations-search", () => locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper())); var allPages = locationService.GetAllPages(itemsPerPage, orderBy, searchTerm, sortOrder.ToUpper()); var result = new PageOfLocations() { Locations = allPages.GetData(Convert.ToInt32(pageNum + 1)), PageNum = pageNum, ItemsPerPage = itemsPerPage, TotalItems = allPages.TotalCount, TotalPages = allPages.PagesCount }; return(result); }