예제 #1
0
        public int InsertCategory(Category category)
        {
            context.Categories.Add(category);
            context.SaveChanges();

            return category.Id;
        }
예제 #2
0
        public void UpdateCategory(Category category)
        {
            Category dbCategory = context.Categories.Find(category.Id);

            if (dbCategory != null)
            {
                dbCategory.Name = category.Name;
                context.SaveChanges();
            }
        }