Exemple #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();
     }
 }
Exemple #2
0
 public void DeleteCategory(Category c)
 {
     context.Category.Remove(c);
     context.SaveChanges();
 }
Exemple #3
0
 public void AddCategory(Category c)
 {
     context.Category.Add(c);
     context.SaveChanges();
 }