public void Edit(Order order) { db.Entry(order).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void Delete(Order order) { db.Orders.Remove(order); db.SaveChanges(); }
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(); }
public void Create(Order order) { db.Orders.Add(order); db.SaveChanges(); }
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 }); }