Kooboo.Commerce.Categories.CategoryTree.BuildEntry C# (CSharp) Méthode

BuildEntry() static private méthode

static private BuildEntry ( Category category, IEnumerable all ) : CategoryTreeNode
category Category
all IEnumerable
Résultat CategoryTreeNode
        static CategoryTreeNode BuildEntry(Category category, IEnumerable<Category> all)
        {
            var entry = new CategoryTreeNode
            {
                Id = category.Id,
                Name = category.Name,
                Description = category.Description,
                Photo = category.Photo,
                CustomFields = category.CustomFields.ToDictionary(f => f.Name, f => f.Value)
            };

            foreach (var child in all.Where(c => c.Parent != null && c.Parent.Id == category.Id))
            {
                var childEntry = BuildEntry(child, all);
                entry.Children.Add(childEntry);
                childEntry.Parent = entry;
            }

            return entry;
        }