Esempio n. 1
0
        public ViewResult Checkout()
        {
            var cart = GetCart();

            ViewBag.value = cart.ComputeTotalValue();
            OrderServiceRef.OrderContractOf_OrderDataClient client = new OrderContractOf_OrderDataClient();
            var        terra       = client.GetTerritory();
            SelectList territories = new SelectList(terra, "TerritoryID", "Name");

            ViewBag.terra = territories;
            ViewBag.cl    = cart.Lines;
            client.Close();
            return(View(new OrderData()));
        }
Esempio n. 2
0
        public ViewResult Checkout(Cart cart, OrderData orderdata)
        {
            cart = GetCart();

            if (cart.Lines.Count == 0)
            {
                ModelState.AddModelError("", "Sorry, your cart is empty!");
            }
            if (ModelState.IsValid)
            {
                OrderServiceRef.OrderContractOf_OrderDataClient client = new OrderContractOf_OrderDataClient();
                orderdata.OrderProducts = cart.Lines;
                orderdata.SubTotal      = cart.ComputeTotalValue();
                client.Create(orderdata);
                cart.Clear();
                client.Close();
                return(View("Completed"));
            }
            else
            {
                return(View(orderdata));
            }
        }