示例#1
0
 public void Edit(Order order)
 {
     db.Entry(order).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
 }
示例#2
0
 public void Delete(Order order)
 {
     db.Orders.Remove(order);
     db.SaveChanges();
 }
示例#3
0
        public ActionResult OrderPartial(CheckoutViewModel vm)
        {

            System.Threading.Thread.Sleep(1000);

            if (ModelState.IsValid)
            {
                var order = new Order();
                order.EmailAddress = vm.Email;
                order.Name = vm.Name;
                order.Phone = vm.Phone;
                order.OrderStatus = "Не просмотрено";
                order.CreatedAt = DateTime.Now;

                _order.Create(order);
                return PartialView("OrderOk");
            }
            throw new HttpException();
        }
示例#4
0
 public void Create(Order order)
 {
     db.Orders.Add(order);
     db.SaveChanges();
 }
示例#5
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 });
        }