Exemplo n.º 1
0
        public static IPublishedContent GetNodeByXpath(string xpath)
        {
            var umbracoHelper = PerRequestCacheManager.UmbracoHelper();
            var node          = umbracoHelper.TypedContentSingleAtXPath(xpath);

            return(node);
        }
Exemplo n.º 2
0
        public static IPublishedContent GetRootNode()
        {
            var umbracoHelper = PerRequestCacheManager.UmbracoHelper();
            var siteRoot      = umbracoHelper.TypedContentAtRoot().FirstOrDefault();

            return(siteRoot);
        }
Exemplo n.º 3
0
        public static IPublishedContent GetRootNode(int?currentPageNodeId)
        {
            var umbracoHelper = PerRequestCacheManager.UmbracoHelper();
            var siteRoot      = umbracoHelper.TypedContent(currentPageNodeId)
                                .AncestorsOrSelf().FirstOrDefault(node => node.Level == ConfigurationParameters.SiteRootLevel);

            return(siteRoot);
        }
Exemplo n.º 4
0
        public static IPublishedContent GetContentById(int id)
        {
            IPublishedContent content = null;

            if (id > default(int))
            {
                var helper = PerRequestCacheManager.UmbracoHelper();
                content = helper.TypedContent(id);
            }

            return(content);
        }
Exemplo n.º 5
0
        public static IPublishedContent GetContentFromAppSettingKey(string appSettingKey)
        {
            IPublishedContent content = null;
            var value = ConfigurationManager.AppSettings[appSettingKey];
            int id;

            if (int.TryParse(value, out id))
            {
                var helper = PerRequestCacheManager.UmbracoHelper();
                content = helper.TypedContent(id);
            }

            return(content);
        }