コード例 #1
0
        public ViewResult Checkout(Cart cart, ShippingDetails shippingDetails)
        {
            if (cart.Lines.Count() == 0)
            {
                ModelState.AddModelError(string.Empty, "Your shopping cart is empty");
            }

            if (ModelState.IsValid)
            {
                orderProcessor.OrderProcess(cart, shippingDetails);
                cart.Clear();

                return(View("Completed"));
            }
            else
            {
                return(View(shippingDetails));
            }
        }