public void AddCartItem(CartItem cI) { using (var context = new ECommerceDataContext(_connectionString)) { context.CartItems.InsertOnSubmit(cI); context.SubmitChanges(); } }
public void Add(int productId, int quantity) { CartRepository repo = new CartRepository(Properties.Settings.Default.ConStr); if(Session["cartId"]== null) { int id = repo.NewCart(); Session["cartId"] = id; } CartItem cartItem = new CartItem(); cartItem.CartId = (int)Session["cartId"]; cartItem.ProductId = productId; cartItem.Quantity = quantity; repo.AddCartItem(cartItem); }
public void UpdateQuantity(CartItem item) { CartRepository repo = new CartRepository(Properties.Settings.Default.ConStr); repo.UpdateItem(item); }
public void UpdateItem(CartItem item, int newQuantity) { item.Quantity += newQuantity; CartRepository repo = new CartRepository(Properties.Settings.Default.ConStr); repo.UpdateItem(item); }
public void UpdateItem(CartItem cartItem) { using(var context = new ECommerceDataContext(_connectionString)) { context.CartItems.Attach(cartItem); context.Refresh(RefreshMode.KeepCurrentValues, cartItem); context.SubmitChanges(); } }
private void detach_CartItems(CartItem entity) { this.SendPropertyChanging(); entity.Product = null; }
private void attach_CartItems(CartItem entity) { this.SendPropertyChanging(); entity.Product = this; }
partial void DeleteCartItem(CartItem instance);
partial void UpdateCartItem(CartItem instance);
partial void InsertCartItem(CartItem instance);