Esempio n. 1
0
        public ScienceSidebarViewModel GetSidebarViewModel(ScienceDetailsPage model)
        {
            var viewModel = CreateViewModel <ScienceSidebarViewModel>(model);

            viewModel.Categories = GetCategoriesWithFeaturedPages(model);

            return(viewModel);
        }
        public ActionResult Index(ScienceDetailsPage model)
        {
            var categoriesProvider = new UmbracoSciencePageCategoriesProvider(ApplicationContext.ApplicationCache.RequestCache);
            var service            = new ScienceDetailsPageService(categoriesProvider, _navigationService);
            var viewModel          = service.GetViewModel(model);

            return(CurrentTemplate(viewModel));
        }
        private IEnumerable <NavigationItemViewModel> GetCategories(ScienceDetailsPage model)
        {
            var categories = _sciencePageCategoriesProvider.GetCategories(model);

            if (ExistenceUtility.IsNullOrEmpty(categories))
            {
                return(Enumerable.Empty <NavigationItemViewModel>());
            }

            return(_navigationItemService.GetViewModels(categories));
        }
        public ScienceDetailsPageViewModel GetViewModel(ScienceDetailsPage model)
        {
            var viewModel = new ScienceDetailsPageViewModel()
            {
                Preamble         = model.Preamble,
                Sections         = GetSectionViewModels(model.MainContent),
                ImageTextSection = GetImageTextSectionViewModels(model.ImageAndTextSection),
                PublishedDate    = model.GetPublishedDateOrDefault(),
                ReviewedDate     = GetReviewedDate(model.ReviewedDate),
                Categories       = GetCategories(model)
            };

            return(viewModel);
        }
Esempio n. 5
0
        private IEnumerable <MainNavigationItemViewModel> GetCategoriesWithFeaturedPages(ScienceDetailsPage model)
        {
            var categories = _sciencePageCategoriesProvider.GetCategories(model);

            return(GetCategoriesWithFeaturedPages(categories));
        }