public ActionResult AddCart() { //create an empty cart Cart cart = new Cart(); return View(cart); }
public ActionResult Buy() { Cart cart = new Cart(); cart.TotalPrice = 0; cart.cartproducts = new List<Product>(); cart.Id = i; cart.UserId = 1; Product product = new Product(); foreach (Product p in cartproducts) { product.Id = p.Id; product.Name = p.Name; product.Price = p.Price; cart.cartproducts.Add(product); cart.TotalPrice += p.Price; i++; } return View(cart); }
public ActionResult SaveCart(Cart cart) { //carts.Add(cart); return View(cart); }