public ActionResult AddProducts(Product product) { if (storemodel.IsValidStore(product.StoreID, data.GetCurrentUser())) { data.AddProduct(product); return View("AddProductSuccess", product); } else return View("ProductAddError"); }
public ActionResult Edit(Product product) { if (productmodel.IsProductOwner(product.ProductID, data.GetCurrentUser())) { return View(productmodel.UpdateProduct(product)); } else return View("ProductAddError"); }
public Product UpdateProduct(Product product) { var updateProduct = GetProduct(product.ProductID); updateProduct.ProductDescription = product.ProductDescription; updateProduct.ProductName = product.ProductName; updateProduct.ProductPrice = product.ProductPrice; updateProduct.ProductQuantity = product.ProductQuantity; webdata.SubmitChanges(); return updateProduct; }
public int AddProduct(Product product) { webstoredata.Products.InsertOnSubmit(product); webstoredata.SubmitChanges(); return product.ProductID; }
private void detach_Products(Product entity) { this.SendPropertyChanging(); entity.Store = null; }
private void attach_Products(Product entity) { this.SendPropertyChanging(); entity.Store = this; }
partial void DeleteProduct(Product instance);
partial void UpdateProduct(Product instance);
partial void InsertProduct(Product instance);
public void RemoveLine(Product product) { cartLines.RemoveAll(x => x.product.ProductID == product.ProductID); }
public void AddToCart(Product product, int quantity) { var line = cartLines.FirstOrDefault(x => x.product.ProductID == product.ProductID); if (line == null) cartLines.Add(new CartLine { product = product, quantity = quantity }); else line.quantity = (line.quantity + quantity) > product.ProductQuantity ? line.quantity + quantity : product.ProductQuantity; }