예제 #1
0
 public ActionResult CheckOut(FormCollection form)
 {
     var order = new OrderHeader();
     order.OrderDate = DateTime.Now;
     if (TryUpdateModel(order))
     {
         var orderViewModel = new OrderConfirmViewModel
         {
             Order = order,
             CartItems = this.CartItems
         };
         return View("Confirm", orderViewModel);
     }
     return View();
 }
예제 #2
0
        public ActionResult Confirm(FormCollection form)
        {
            if (CartItems.Count <= 0)
                return RedirectToAction("Index", "Cart");
            var order = new OrderHeader();
            order.OrderDate = DateTime.Now;

            if (TryUpdateModel(order))
            {
                var orderViewModel = new OrderConfirmViewModel
                {
                    Order = order,
                    CartItems = this.CartItems
                };
                return View(orderViewModel);
            }
            return View("CheckOut");
        }