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