public void Save(Category category) { if (category.CategoryID == 0) context.Categories.Add(category); else { context.Entry(category).State = System.Data.EntityState.Modified; } context.SaveChanges(); }
public void Delete(Category category) { context.Categories.Remove(category); context.SaveChanges(); }