Пример #1
0
        private static IEnumerable<ItemCategory> GetItemCategorySubcategories(ItemCategory parentCategory, IEnumerable<ItemCategory> categories)
        {
            var subCategories = categories.Where(c => c.ParentItemCategoryID == parentCategory.ItemCategoryID).ToList();

            foreach (var subCategory in subCategories)
            {
                subCategory.Subcategories = GetItemCategorySubcategories(subCategory, categories);
            }

            return subCategories;
        }