public void Delete(Product products) { using (NorthWindContext context = new NorthWindContext()) { var entity = context.Entry(products); entity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Product products) { using (NorthWindContext context = new NorthWindContext()) { //context.Products.Add(products); var entity = context.Entry(products); entity.State = EntityState.Added; context.SaveChanges(); } }