Beispiel #1
0
        public void Imports(ICollection <Catalog_Categories> items)
        {
            var query = from c in items
                        where c.ParentId == null
                        select c;

            foreach (var q in query.OrderBy(o => o.Pos))
            {
                var item = new CatalogCategoryTreeItemModel
                {
                    Id    = q.Id,
                    Level = q.Level,
                    Title = q.Title
                };
                Items.Add(item);
                recursiveParser(items, item);
            }
        }
Beispiel #2
0
        private void recursiveParser(ICollection <Catalog_Categories> items, CatalogCategoryTreeItemModel item)
        {
            var query = from f in items
                        where f.ParentId == item.Id
                        select f;

            foreach (var q in query)
            {
                var nitem = new CatalogCategoryTreeItemModel
                {
                    Id    = q.Id,
                    Level = q.Level,
                    Title = q.Title
                };
                item.Items.Add(nitem);
                recursiveParser(items, nitem);
            }
        }