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

            return View(cart);
        }
コード例 #2
0
        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;
 }
コード例 #4
0
        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");
 }
コード例 #6
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
     };
     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;
        }