public ActionResult Edit(OrderRequestForm form) { using (var session = MvcApplication.DocumentStore.OpenSession()) { var order = session.Load<OrderRequest>(form.Id); order.Customer = new Customer { FirstName = form.CustomerFirstName, LastName = form.CustomerLastName }; order.Status = Status.Submitted; session.SaveChanges(); return RedirectToAction("Success", new {id = form.Id}); } }
// // GET: /Checkout/ public ActionResult Edit(Guid id) { using (var session = MvcApplication.DocumentStore.OpenSession()) { var order = session.Load<OrderRequest>(id); var form = new OrderRequestForm { Id = order.Id, Total = order.Total, Items = order.Items.Select(item => new OrderRequestForm.LineItem() { ProductName = item.ProductName, Quantity = item.Quantity, ListPrice = item.ListPrice, Subtotal = item.Subtotal }).ToList() }; return View(form); } }