public CategorizedProductOutputModel(category root)
        {
            Category = new CategoryOutputModel(root);

            Subcategories = new List<CategorizedProductOutputModel>();

            foreach (category c in root.categories.Where(x => x.category1 == root))
            {
                Subcategories.Add(new CategorizedProductOutputModel(c));
            }

            Products = new List<ProductOutputModel>();

            foreach (product p in root.products_categories.Select(x => x.product))
            {
                Products.Add(new ProductOutputModel(p));
            }
        }
Exemplo n.º 2
0
        public CategoryOutputModel fillCategoryModel(category c)
        {
            if (c == null) return null;

            CategoryOutputModel om = new CategoryOutputModel();
            om.Id = c.id;

            om.Parent = c.parentid;

            om.Content = this._app.fillLangModel(c.text.texts_values);
            om.Title = this._app.fillLangModel(c.title.texts_values);

            return om;
        }