private ActionResult ContentPage(ContentPage page, Guid id, User user, int c, int o)
        {
            // Page/Category view
            this.ViewData["BreadcrumbViewModel"]     = MenuViewModelFactory.CreateBreadcrumb(repository, id);
            this.ViewData["NavigationMenuViewModel"] = MenuViewModelFactory.CreateNavigationMenu(repository, id, this.Request);

            var viewModel = new PageViewModel(page, this.repository);

            this.ViewData["ProductItemsViewModel"] = CategoryViewModelFactory.CreateCategoryViewModel(user, page, c, o, ListingViewProductSettings.User);

            this.ViewData["IsPage"] = !viewModel.ContentPage.IsCategory();
            return(this.View(viewModel));
        }
        public ActionResult Page(Guid?id, Guid?parentId, int c = 200, int o = 0)
        {
            if (id == null || id == Guid.Empty)
            {
                return(this.RedirectToAction("Index"));
            }

            this.Initialize(id.Value);

            Product product;

            var user = UserIdentityManager.GetActiveUser(this.Request, repository);

            this.ViewData["Id"]      = id.Value;
            this.ViewData["IsAdmin"] = user != null && user.IsAdmin;

            var contentPage = this.repository.GetPageById(id.Value);

            if (contentPage != null)
            {
                return(this.ContentPage(contentPage, id.Value, user, c, o));
            }
            else if ((product = repository.GetProductById(id.Value)) != null)
            {
                this.ViewData["BreadcrumbViewModel"]     = MenuViewModelFactory.CreateBreadcrumb(repository, parentId);
                this.ViewData["NavigationMenuViewModel"] = MenuViewModelFactory.CreateNavigationMenu(repository, parentId, this.Request);

                //this.ViewData["MediaListViewModel"] = CategoryViewModelFactory.CreateSimilarProducts(repository, parentId);

                var productViewModel = new ProductViewModel(this.repository, id.Value, parentId, user);
                return(this.View("Product", productViewModel));
            }
            else
            {
                return(this.HttpNotFound());
            }
        }
Ejemplo n.º 3
0
 protected override void Initialize(Guid pageId, PageIdentity pageIdentity = PageIdentity.Unknown, bool promoteProducts = true)
 {
     base.Initialize(pageId);
     this.ViewData["NavigationMenuViewModel"] = MenuViewModelFactory.CreateNavigationMenu(repository, null, this.Request);
     this.ViewData["BreadcrumbViewModel"]     = MenuViewModelFactory.CreateBreadcrumb(repository, null);
 }