Пример #1
0
 public void UpdateCategory(Category categoryUpdated)
 {
     Category category = context.Category.Where(c => c.Id == categoryUpdated.Id).FirstOrDefault();
     if (category != null)
     {
         category.Name = categoryUpdated.Name;
         context.SaveChanges();
     }
 }
Пример #2
0
 public void DeleteCategory(Category c)
 {
     context.Category.Remove(c);
     context.SaveChanges();
 }
Пример #3
0
 public void AddCategory(Category c)
 {
     context.Category.Add(c);
     context.SaveChanges();
 }