public ActionResult HeaderNavigation()
        {
            var model = new HeaderNavigationViewModel();

            model.Initialize(RenderingContext.Current.Rendering);
            if (model.GlassItem == null)
            {
                return(DataSourceNotConfiguredResult);
            }
            model.MenuItems = model.GlassItem.Children.Select(i => _sitecoreService.Cast <I_LinkMenuItem>(i.InnerItem));
            return(View("HeaderNavigation", model));
        }
Exemplo n.º 2
0
        private ISite_Root getSiteRoot(Item item)
        {
            string cacheKey = $"{item.ID}-ItemSiteRoot";

            ISite_Root siteRoot = _cacheProvider.GetFromCache <ISite_Root>(cacheKey);

            if (siteRoot == null)
            {
                //item.Parent because on Created event the next line returns empty
                var articleItem = _service.Cast <ArticleItem>(item.Parent);

                siteRoot = articleItem.Crawl <ISite_Root>();
                _cacheProvider.AddToCache <ISite_Root>(cacheKey, siteRoot);
            }

            return(siteRoot);
        }