public static void DeleteOnSubmit(this DbSet<Product> source, Product product) { source.Remove(product); }
/// <summary> /// Initializes a new instance of the <see cref="ShoppingCartItem"/> class. /// </summary> /// <param name="product">The product.</param> public ShoppingCartItem(Product product) { Product = product; }
public static void InsertOnSubmit(this DbSet<Product> source, Product product) { if (product.ProductID == default(int)) { // New entity source.Add(product); } else { // Existing entity source.Attach(product); } }