public ActionResult Checkout(Cart cart) { if (cart.Lines.Any() == false) { ModelState.AddModelError("Cart", "Désolé, votre panier est vide."); } if (ModelState.IsValid) { double totalTimeToCook = cart.Lines.Sum(x => x.Dish.TimeToCook); int amount = (int) cart.Lines.Sum(x => x.Dish.Price); int tableId = GetTableId(); Table table = restaurantService.GetTable(tableId); Order order = new Order() { Table = table, OrderState = OrderState.New, CartLines = cart.Lines, Price = cart.Lines.Sum(x => x.Dish.TimeToCook), Date = DateTime.Now }; OrderService orderService = new OrderService(); orderService.AddOrder(order); this.HttpContext.Session.Clear(); return View("Paypal", amount); //return View(totalTimeToCook); } return RedirectToAction("Index", "Client"); }
public WaiterController() { orderService = new OrderService(); }
public KitchenController() { orderService = new OrderService(); }
public ActionResult ListOrders() { OrderService orderService = new OrderService(); List<Order> orders = orderService.GetAllOrders(); return View(orders); }