コード例 #1
0
        public PartialViewResult ProductsToPagedList(IEnumerable <ProductViewModel> model, int?page)
        {
            string sortOrder  = null;
            bool   descending = false;

            if (SortingManager.SortOrder != null)
            {
                sortOrder  = SortingManager.SortOrder;
                descending = SortingManager.IsSortDescending;
                SortingManager.SetSorting(sortOrder, descending);
            }

            IEnumerable <ProductViewModel> sortedModel = model.SortBy(x => x.Name, sortOrder, descending);
            int pageNumber = page ?? 1;
            IPagedList <ProductViewModel> viewModel = new PagedList <ProductViewModel>(sortedModel, pageNumber, 9);

            return(PartialView("_ProductsDeck", viewModel));
        }
コード例 #2
0
 protected void SaveSortingState(string sortOrder, bool descending, string searchTerm = null)
 {
     SortingManager.SetSorting(sortOrder, descending, searchTerm);
 }