예제 #1
0
        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});
            }
        }
예제 #2
0
        //
        // 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);
            }
        }