public ActionResult Empty() { Session["ShoppingCart"] = new ShoppingCart(); Session["ShoppingCartQuantity"] = 0; Session["ShoppingCartPrice"] = 0; return RedirectToAction("Index"); }
private void CheckShoppingCart() { if((ShoppingCart)Session["ShoppingCart"] == null) { Session["ShoppingCart"] = new ShoppingCart(); Session["ShoppingCartQuantity"] = 0; Session["ShoppingCartPrice"] = 0; } }
public ActionResult NewOrder() { if(Session["CustomerEmail"] == null) return RedirectToAction("AccessDenied"); int orderID = new DAOrder().insert(new Order((ShoppingCart)Session["ShoppingCart"], new Customer() { ID = new DACustomer().selectOne((string)Session["CustomerEmail"]).ID })); UpdateItemQuantity(); Session["ShoppingCart"] = new ShoppingCart(); Session["ShoppingCartQuantity"] = 0; Session["ShoppingCartPrice"] = 0; return RedirectToAction("Order", new { ID = orderID }); }
public Order(ShoppingCart cart, Customer customer) { this.ID = 0; this.customer = customer; lines = cart.items.Select(item => new OrderLine(){ ID = 0, item = item.item, quantity = item.quantity }).ToList(); this.orderTime = DateTime.Now; this.sentTime = null; this.totalPrice = cart.totalPrice; }