Esempio n. 1
0
        //-------------------------
        //-------------------------
        private NodeDisplayViewModel NodeDisplayPrep(ContentNode node, string nodePath)
        {
            // Default property values, if node is null.
            string content = "";
            int    id      = 0;
            string title   = "Content at \"" + nodePath + "\" not found";

            if (node != null)
            {
                content = node.Content.Replace(System.Environment.NewLine, "<br/>");
                id      = node.NodeId;
                title   = node.Title;
            }

            // Get the list of links to children of this node.
            List <ContentLinkInfo> childLinks = contentManager.ContentChildLinksGet(node);

            // If the node has no children, the list of links to its siblings will be displayed.
            if (childLinks != null)
            {
                if (childLinks.Count == 0)
                {
                    childLinks = contentManager.ContentSiblingLinksGet(node);
                }
            }


            NodeDisplayViewModel model = new NodeDisplayViewModel
            {
                BlogTodayExists = contentManager.BlogEntryTodayExistsTest(),
                ChildLinks      = childLinks,
                PathLinks       = contentManager.ContentPathLinksGet(node),
                Content         = content,
                Id    = id,
                Title = title
            };

            return(model);
        }