public IBlogHub GetMainBlogHub()
        {
            const string cachingKey = "Blog.MainHub";

            if (_cache.Contains(cachingKey))
            {
                return(_cache.Retrieve <IBlogHub>(cachingKey));
            }

            var root = _strongContentService.GetRootNodes().First();

            var blogHub = _strongContentService.GetChildNodes <IBlogHub>(root).FirstOrDefault();

            blogHub = blogHub ?? _strongContentService.GetDescendantNodes <IBlogHub>(root).FirstOrDefault();

            if (blogHub != null)
            {
                _cache.Add(cachingKey, blogHub);
            }

            return(blogHub);
        }
        public ActionResult PrimaryNavigation()
        {
            var root = _contentService.GetRootNodes().First();

            var navPages = _contentService.GetChildNodes <IPage>(root).Where(p => p.ShowInNavigation);

            var navModel = new NavigationModel
            {
                NavigationItems = navPages.Select(CreateNavigationItem)
            };

            return(View("~/Views/Partials/PrimaryNavigationView.cshtml", navModel));
        }
示例#3
0
        public IEnumerable <IArticle> GetAllArticles()
        {
            var root = _strongContentService.GetRootNodes().First();

            return(_strongContentService.GetDescendantNodes <IArticle>(root));
        }