public ActionResult Index(GenericProduct currentContent) { var breadcrumb = _breadcrumbService.GenerateBreadCrumb(currentContent); var variantRefs = currentContent.GetVariants().ToList(); var variants = _contentLoader.GetItems(variantRefs, CultureInfo.CurrentUICulture) .OfType <GenericVariant>() .Select(_productFactory.BuildVariantItem) .ToList(); var viewModel = new ProductPageViewModel(new ProductItemViewModel(currentContent), variants); viewModel.Breadcrumb = breadcrumb; return(View("~/Features/Catalog/Product/Presentation/Views/Index.cshtml", viewModel)); //return View(); }
public ActionResult Index(Domain.Category currentContent) { var breadcrumb = _breadcrumbService.GenerateBreadCrumb(currentContent); var categories = _contentLoader.GetChildren <Domain.Category>(currentContent.ContentLink) .ToList(); if (categories.Any()) { var categoryItems = categories .Select(x => new CategoryItemViewModel(x)) .ToList(); var categoryViewModel = new CategoryPageViewModel(currentContent) { Categories = categoryItems }; categoryViewModel.Breadcrumb = breadcrumb; //TODO: Add view path return(View("~/Features/Catalog/Category/Presentation/Views/Index.cshtml", categoryViewModel)); } var products = _contentLoader.GetChildren <GenericProduct>(currentContent.ContentLink) .Select(_categoryFactory.BuildProductItem) .Where(x => x.MinPrice != 0) .ToList(); var viewModel = new CategoryPageViewModel(currentContent) { Products = products }; viewModel.Breadcrumb = breadcrumb; return(View("~/Features/Catalog/Category/Presentation/Views/Index.cshtml", viewModel)); }