示例#1
0
        public ActionResult Buy(ShoppingCart cart)
        {
            Customer customer = (Customer) TempData.Peek("customer");
            cart.Customer = customer;

            return View(cart);
        }
        public ActionResult AddToCart(ShoppingCart cart, int id)
        {
            MovieDto movie = service.GetOne(id);
            cart.AddOrderLine(movie, 1);

            return RedirectToAction("Index");
        }
示例#3
0
 private ShoppingCart GetCart()
 {
     var cart = Session["ShoppingCart"] as ShoppingCart;
     if (cart == null)
     {
         cart = new ShoppingCart();
         Session["ShoppingCart"] = cart;
     }
     return cart;
 }
        public ActionResult Buy(ShoppingCart cart)
        {
            Customer customer = (Customer) TempData.Peek("customer");
            int customerId = customer.Id;
            //customer = _efService.Customers.GetById(customerId, "Address");
            customer = serviceCustomer.GetOne(customerId,"Address");

            cart.Customer = customer;

            return View(cart);
        }
示例#5
0
 public ActionResult BuyConfirmed(ShoppingCart cart)
 {
     Customer customer = (Customer) TempData["customer"];
     Order order = new Order
     {
         Customer = customer,
         CustomerId = customer.Id,
         Date = DateTime.Now,
         OrderLines = cart.orderLines
     };
     _facade._orderRepository.Add(order);
     cart.CleanCart();
     return View("Confirmed");
 }
 public ActionResult BuyConfirmed(ShoppingCart cart)
 {
     Customer customer = (Customer) TempData["customer"];
     Order order = new Order
     {
         Customer = customer,
         CustomerId = customer.Id,
         Date = DateTime.Now,
         OrderLines = cart.orderLines
     };
     service.CreateOne(order);
     //_efService.Orders.Create(order);
     //_efService.Save();
     cart.CleanCart();
     return View("Confirmed");
 }
示例#7
0
        public object BindModel(ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext)
        {
            ShoppingCart cart = null;
            if (controllerContext.HttpContext.Session!=null)
            {
                cart = (ShoppingCart) controllerContext.HttpContext.Session[sessionKey];
            }

            if (cart == null)
            {
                cart = new ShoppingCart();
                if (controllerContext.HttpContext.Session !=null)
                {
                    {
                        controllerContext.HttpContext.Session[sessionKey] = cart;
                    }
                }
            }
            return cart;
        }