Ejemplo n.º 1
0
        public List<GoodCategory> GetAllCategories()
        {
            using (var context = new EntitiesContext())
            {
                var categories = context.GoodCategories.ToList();

                CreateTree(categories);

                return categories;
            }
        }
Ejemplo n.º 2
0
        public void CreateGoodCategory(GoodCategoryViewModel model)
        {
            using (var context = new EntitiesContext())
            {
                var newCategory = new GoodCategory
                {
                    Name = model.Name
                };

                context.GoodCategories.Add(newCategory);
                context.SaveChanges();
            }
        }