예제 #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));
        }
예제 #2
0
        public void SetLayout(LayoutViewModel layoutViewModel)
        {
            LayoutModel layout = pageContentService.Layout;

            layoutViewModel.LogoImage = new ResponsiveImageViewModel(
                layout.LogoImage.Title,
                TourtechUrlHelper.GetImageUrl(layout.LogoImage.ImageRelativeUrl),
                TourtechUrlHelper.GetImageUrl(layout.LogoImage.MobileImageRelativeUrl)
                );
            layoutViewModel.StripesImage   = ImageHelper.MapImageToViewModel(layout.StripesImage);
            layoutViewModel.HamburgerImage = ImageHelper.MapImageToViewModel(layout.HamburgerImage);

            IEnumerable <CategoryModel> categories = productsService.GetCategories();

            layoutViewModel.MainMenu =
                new MenuItemViewModel[]
            {
                new MenuItemViewModel("Home", Url.Action("Index", "Home")),
                new MenuItemViewModel(
                    "Products",
                    Url.Action("Index", "Products"),
                    categories.Select(a => new MenuItemViewModel(a.Title, TourtechUrlHelper.GetCategoryUrl(a.Name)))
                    ),
                new MenuItemViewModel("Where To Buy", Url.Action("Index", "WhereToBuy")),
            }
            ;
        }
예제 #3
0
        public ActionResult Index(string productName)
        {
            CategoryModel category;

            try
            {
                category = productsService.GetCategoryByProduct(productName);
            }
            catch (ClientException)
            {
                return(NotFoundResult());
            }

            ProductModel product = category.Products.Single(a => a.Name == productName);

            ProductViewModel indexViewModel = new ProductViewModel(
                ContentSectionHelper.MapContentSectionsToViewModels(product.ContentSections),
                product.GalleryImages.Select(b => ImageHelper.MapImageToViewModel(b)),
                product.OverviewParagraphs,
                product.Features
                )
            {
                Breadcrumb      = BreadcrumbHelper.GetProductBreadcrumb(Url, category.Title, category.Name, product.Title, product.Name),
                MainHeading     = product.Title,
                BannerImageUrl  = TourtechUrlHelper.GetImageUrl(product.BannerImageRelativeUrl),
                Title           = product.MetaData.Title,
                MetaDescription = product.MetaData.MetaDescription
            };

            SetLayout(indexViewModel);

            return(View(indexViewModel));
        }
예제 #4
0
        public ActionResult Index()
        {
            IEnumerable <CategoryViewModel> categories =
                productsService.GetCategories().Select(a =>
                                                       new CategoryViewModel()
            {
                Title      = a.Title,
                ImageUrl   = TourtechUrlHelper.GetImageUrl(a.ImageRelativeUrl),
                LinkUrl    = TourtechUrlHelper.GetCategoryUrl(a.Name),
                ComingSoon = a.ComingSoon
            }
                                                       )
            ;

            PageModel productsPageContent = pageContentService.ProductsPage;

            ProductsViewModel viewModel =
                new ProductsViewModel()
            {
                Breadcrumb      = BreadcrumbHelper.GetProductsBreadcrumb(Url),
                MainHeading     = productsPageContent.MainHeading,
                Categories      = categories,
                Title           = productsPageContent.MetaData.Title,
                MetaDescription = productsPageContent.MetaData.MetaDescription
            }
            ;

            SetBannerToDefault(viewModel);

            SetLayout(viewModel);

            return(View(viewModel));
        }
예제 #5
0
        public ActionResult Index()
        {
            IEnumerable <RetailerViewModel> retailers =
                retailerService.GetRetailers().Select(
                    a => new RetailerViewModel()
            {
                Name                 = a.Name,
                DesktopImageUrl      = TourtechUrlHelper.GetImageUrl(a.DesktopImageRelativeUrl),
                MobileImageUrl       = TourtechUrlHelper.GetImageUrl(a.MobileImageRelativeUrl),
                WebsiteUrl           = a.WebsiteUrl,
                WebsiteUrlForDisplay = a.WebsiteUrlForDisplay,
                BackgroundColourHex  = a.BackgroundColourHex,
                TextColourHex        = a.TextColourHex
            }
                    )
            ;

            PageModel whereToBuyPage = pageContentService.WhereToBuyPage;

            WhereToBuyViewModel viewModel = new WhereToBuyViewModel()
            {
                Breadcrumb      = BreadcrumbHelper.GetWhereToBuyBreadcrumb(Url, whereToBuyPage.MainHeading),
                MainHeading     = whereToBuyPage.MainHeading,
                Retailers       = retailers,
                Title           = whereToBuyPage.MetaData.Title,
                MetaDescription = whereToBuyPage.MetaData.MetaDescription
            };

            SetBannerToDefault(viewModel);

            SetLayout(viewModel);

            return(View(viewModel));
        }
예제 #6
0
        public ActionResult Index()
        {
            HomePageModel homePageContent = pageContentService.HomePage;

            HomeViewModel viewModel =
                new HomeViewModel()
            {
                MainHeading = homePageContent.MainHeading,
                Banners     = homePageContent.Banners.Select(
                    a => new BannerViewModel(
                        ImageHelper.MapImageToViewModel(a.BannerOverlayLogo),
                        new ResponsiveImageViewModel(
                            a.Image.Title,
                            TourtechUrlHelper.GetImageUrl(a.Image.ImageRelativeUrl),
                            TourtechUrlHelper.GetImageUrl(a.Image.MobileImageRelativeUrl)
                            ),
                        a.OverlayText,
                        TourtechUrlHelper.GetCategoryUrl(a.OverlayLinkCategoryName),
                        a.AlternateColorTheme
                        )
                    ),
                CategoryTiles = homePageContent.CategoryTiles.Select(
                    b => new CategoryTileViewModel(
                        ImageHelper.MapImageToViewModel(b.Image),
                        b.Text, b.LinkText,
                        TourtechUrlHelper.GetCategoryUrl(b.LinkCategoryName)
                        )
                    ),
                Products        = ProductHelper.MapProductsToViewModels(productsService.GetProducts()),
                Title           = homePageContent.MetaData.Title,
                MetaDescription = homePageContent.MetaData.MetaDescription
            }
            ;

            SetLayout(viewModel);

            return(View(viewModel));
        }
예제 #7
0
 public void SetBannerToDefault(SubPageViewModel pageViewModel)
 {
     pageViewModel.BannerImageUrl = TourtechUrlHelper.GetImageUrl(pageContentService.DefaultBannerImageRelativeUrl);
 }