Ejemplo n.º 1
0
        public FolderTree FolderTree()
        {
            FolderTree folderTree = getRootAndChildren();

            for (int i = 0; i < folderTree.Children.Count(); i++)
            {
                var nodeToPopulate = folderTree.Children[i];
                nodeToPopulate = PopulateFolderTreeNode(nodeToPopulate);
            }

            return(folderTree);
        }
Ejemplo n.º 2
0
        private FolderTree PopulateFolderTreeNode(FolderTree parentNode)
        {
            parentNode.Children = folderRepository.GetFoldersWithParentOfID(parentNode.Id)
                                  .Select(t => new FolderTree {
                Id = t.Id, Name = t.Name
            }).ToList();

            foreach (var childNode in parentNode.Children)
            {
                PopulateFolderTreeNode(childNode);
            }
            return(parentNode);
        }