コード例 #1
0
        public List<GoodCategory> GetAllCategories()
        {
            using (var context = new EntitiesContext())
            {
                var categories = context.GoodCategories.ToList();

                CreateTree(categories);

                return categories;
            }
        }
コード例 #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();
            }
        }