public void UpdateCategory(Category category) { using (var context = new ClothShopContext()) { context.Entry(category).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void SaveCategory(Category category) { using (var context = new ClothShopContext()) { context.Categories.Add(category); context.SaveChanges(); } }
public void DeleteCategory(int ID) { using (var context = new ClothShopContext()) { // context.Entry(category).State = System.Data.Entity.EntityState.Deleted; var category = context.Categories.Find(ID); context.Categories.Remove(category); context.SaveChanges(); } }