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