Пример #1
0
 public void UpdatePayment(Checkout_Payment vm)
 {
     ClientDetails.Payment = vm.Payment;
 }
Пример #2
0
        public ActionResult ProceedPayment(Checkout_Payment vm)
        {
            if (ModelState.IsValid)
            {
                var cart = GetCart();
                var clientInfo = cart.ClientDetails;
                var step2CheckInputs = cart.ClientDetails.HasEmptyProperties();
                if (!step2CheckInputs) {
                    RedirectToAction("Checkout", new { step = 2 });
                }
                cart.UpdatePayment(vm);
                var order = new Order();
                order.Address = cart.ClientDetails.Address;
                order.Name = string.Format("{0} {1}", clientInfo.FirstName, clientInfo.LastName);
                order.Phone = clientInfo.Phone;
                order.OrderStatus = "Не просмотрено";
                order.Payment = clientInfo.Payment;
                order.CreatedAt = DateTime.Now;
                order.Delivery = clientInfo.Delivery;
                order.OrderSum = cart.TotalValue();
                order.Sequance = 1;
                _order.Create(order);
                foreach (var item in cart.Lines)
                {
                    _orderItem.Create(item.Product, item.Quantity, order.ID);
                }
                /*
                YaMoney ya = new YaMoney();
                string url = ya.GetTokenRequestURL();
                Response.Redirect(url);
                */
                cart.Clear();

                return RedirectToAction("Finished");
            }
            return RedirectToAction("Index", new { step = 4 });
        }