示例#1
0
        public ActionResult Index(string categoryName)
        {
            CategoryModel category;

            try
            {
                category = productsService.GetCategory(categoryName);
            }
            catch (ClientException)
            {
                return(NotFoundResult());
            }

            CategoryViewModel viewModel =
                new CategoryViewModel()
            {
                Breadcrumb      = BreadcrumbHelper.GetCategoryBreadcrumb(Url, category.Title, categoryName),
                MainHeading     = category.Title,
                Sections        = ContentSectionHelper.MapContentSectionsToViewModels(category.ContentSections),
                Products        = ProductHelper.MapProductsToViewModels(category.Products),
                BannerImageUrl  = TourtechUrlHelper.GetImageUrl(category.BannerImageRelativeUrl),
                Title           = category.MetaData.Title,
                MetaDescription = category.MetaData.MetaDescription
            }
            ;

            SetLayout(viewModel);

            return(View(viewModel));
        }