示例#1
0
        public ActionResult Manager(int?productCategoryId, string SortBy, bool?SortAscending, bool returnToFrontEnd = false)
        {
            StoreFront           storeFront = CurrentStoreFrontOrThrow;
            IQueryable <Product> query      = null;

            if (!productCategoryId.HasValue)
            {
                ProductCategory firstCategory = storeFront.ProductCategories.AsQueryable().ApplyDefaultSort().FirstOrDefault();
                if (firstCategory != null)
                {
                    productCategoryId = firstCategory.ProductCategoryId;
                }
            }

            if (productCategoryId.HasValue && productCategoryId.Value != 0)
            {
                query = storeFront.Products.Where(p => p.ProductCategoryId == productCategoryId.Value).AsQueryable();
            }
            else
            {
                query = storeFront.Products.AsQueryable();
            }
            IOrderedQueryable <Product> products = query.ApplySort(this, SortBy, SortAscending);

            CatalogAdminViewModel viewModel = this.CatalogAdminViewModel;

            viewModel.UpdateSortedProducts(products);
            viewModel.FilterProductCategoryId = productCategoryId;
            viewModel.SortBy           = SortBy;
            viewModel.SortAscending    = SortAscending;
            viewModel.ReturnToFrontEnd = returnToFrontEnd;
            ViewData.Add("ReturnToFrontEnd", returnToFrontEnd);
            return(View("Manager", this.CatalogAdminViewModel));
        }
示例#2
0
        public ActionResult Manager(bool returnToFrontEnd = false)
        {
            CatalogAdminViewModel model = new CatalogAdminViewModel(CurrentStoreFrontConfigOrThrow, CurrentUserProfileOrThrow);

            model.ReturnToFrontEnd = returnToFrontEnd;
            return(View("Manager", model));
        }