コード例 #1
0
        private static SaveCategoryTreeNodeModel ToModel(CategoryNodeModel n, bool resetIds)
        {
            var model = new SaveCategoryTreeNodeModel
            {
                Id = resetIds ? default(Guid) : n.Id,
                Version = n.Version,
                Name = n.Name,
                DisplayOrder = n.DisplayOrder,
                Macro = n.Macro
            };

            return model;
        }
コード例 #2
0
        private Module.Root.Services.Categories.CategoryNodeModel RemapChildren(SaveCategoryTreeNodeModel node, Guid?parentId)
        {
            var categoryNode = new Module.Root.Services.Categories.CategoryNodeModel();
            IList <Module.Root.Services.Categories.CategoryNodeModel> childrenCategories = new List <Module.Root.Services.Categories.CategoryNodeModel>();

            categoryNode.DisplayOrder = node.DisplayOrder;
            categoryNode.Id           = node.Id ?? Guid.Empty;
            categoryNode.Macro        = node.Macro;
            categoryNode.Title        = node.Name;
            categoryNode.Version      = node.Version;

            if (node.Nodes != null)
            {
                foreach (var childNode in node.Nodes)
                {
                    childrenCategories.Add(RemapChildren(childNode, node.Id));
                }
                categoryNode.ChildNodes = childrenCategories;
            }

            return(categoryNode);
        }
コード例 #3
0
        private Module.Root.Services.Categories.CategoryNodeModel RemapChildren(SaveCategoryTreeNodeModel node, Guid? parentId)
        {
            var categoryNode = new Module.Root.Services.Categories.CategoryNodeModel();
            IList<Module.Root.Services.Categories.CategoryNodeModel> childrenCategories = new List<Module.Root.Services.Categories.CategoryNodeModel>();
            categoryNode.DisplayOrder = node.DisplayOrder;
            categoryNode.Id = node.Id ?? Guid.Empty;
            categoryNode.Macro = node.Macro;
            categoryNode.Title = node.Name;
            categoryNode.Version = node.Version;

            if (node.Nodes != null)
            {
                foreach (var childNode in node.Nodes)
                {
                    childrenCategories.Add(RemapChildren(childNode, node.Id));
                }
                categoryNode.ChildNodes = childrenCategories;
            }

            return categoryNode;
        }