Exemplo n.º 1
0
 // GET: Cart
 public ActionResult Index()
 {
     if(Session["ShoppingCart"] == null)
     {
         Session["ShoppingCart"] = new ShoppingCart();
     }
     return View(facade.GetOrderRepository().ReadAll());
 }
Exemplo n.º 2
0
        public ActionResult AddToCart(int movieId)
        {
            ShoppingCart cart = Session["ShoppingCart"] as ShoppingCart;
            if (cart == null)
            {
                cart = new ShoppingCart();
            }

            Movie movie = facade.GetMovieGateway().Read(movieId);
            OrderLine line = new OrderLine() { Movie = movie, Amount = 1};
            cart.AddOrderLine(line);

            Session["ShoppingCart"] = cart;
            return Redirect("Index");
        }