Beispiel #1
0
 public ActionResult AddProducts(Product product)
 {
     if (storemodel.IsValidStore(product.StoreID, data.GetCurrentUser())) {
         data.AddProduct(product);
         return View("AddProductSuccess", product);
     }
     else return View("ProductAddError");
 }
Beispiel #2
0
 public ActionResult Edit(Product product)
 {
     if (productmodel.IsProductOwner(product.ProductID, data.GetCurrentUser()))
     {
         return View(productmodel.UpdateProduct(product));
     }
     else return View("ProductAddError");
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
 public int AddProduct(Product product)
 {
     webstoredata.Products.InsertOnSubmit(product);
     webstoredata.SubmitChanges();
     return product.ProductID;
 }
Beispiel #5
0
		private void detach_Products(Product entity)
		{
			this.SendPropertyChanging();
			entity.Store = null;
		}
Beispiel #6
0
		private void attach_Products(Product entity)
		{
			this.SendPropertyChanging();
			entity.Store = this;
		}
Beispiel #7
0
 partial void DeleteProduct(Product instance);
Beispiel #8
0
 partial void UpdateProduct(Product instance);
Beispiel #9
0
 partial void InsertProduct(Product instance);
Beispiel #10
0
 public void RemoveLine(Product product)
 {
     cartLines.RemoveAll(x => x.product.ProductID == product.ProductID);
 }
Beispiel #11
0
 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;
 }