public ActionResult Checkout() { var cart = ShoppingCart.Instance; var order = new ENCustomerOrder(); order.DataOrder = DateTime.Now; order.CustomerId = 1;//TODO: Get Customer from Session foreach (var item in cart.Items) { order.AddLine(item.Book, item.Quantity); } try { order.Save(); cart.Items.Clear(); } catch (Exception ex) { } return View("Cart",ShoppingCart.Instance); }
public JsonResult CustomerOrderUpdate(ENCustomerOrder order) { try { order.Save(); return Json(new { Result = "OK" }); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }