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(); }
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"); }