public ViewResult ViewFromSession() { order order = (order)Session["ORDER"]; if (order == null) { user authUser = Util.User.UserUtil.getAuthenticatedUser(Request); if (authUser == null) return View("ViewFromSession", new OrderVM()); // failure order = Util.Session.SessionUtil.getOpenOrder(authUser); } OrderVM orderVM = new OrderVM(order); if (order != null) { foreach (order_item oi in order.order_item) { menu_item mi = Util.Order.OrderUtil.filterMenuItem(oi); side si = Util.Order.OrderUtil.filterSide(oi); OrderItemVM orderItemVM = new OrderItemVM(oi, mi, si); orderVM.addItem(orderItemVM); } } return View(orderVM); }
public ActionResult ViewOrderStatus(int id) { order order = im.find(id); Session["ORDER"] = order; OrderVM orderVM = new OrderVM(order); if (order != null) { foreach (order_item oi in order.order_item) { menu_item mi = Util.Order.OrderUtil.filterMenuItem(oi); side si = Util.Order.OrderUtil.filterSide(oi); OrderItemVM orderItemVM = new OrderItemVM(oi, mi, si); orderVM.addItem(orderItemVM); } } return View("OrderUserDetails", orderVM); }
/*public ViewResult RetrieveOrderItems() { var orders = db.orders.Include(o => o.order_status).Include(o => o.user).Include(o => o.waiter).OrderBy(o => o.table_id).ThenBy(o => o.timestamp); return View(); } */ public ActionResult Editing(int id) { order order = im.find(id); Session["ORDER"] = order; order.order_status = (int)OrderStatusHelper.OrderStatusEnum.EDITING; db.SaveChanges(); OrderVM orderVM = new OrderVM(order); if (order != null) { foreach (order_item oi in order.order_item) { menu_item mi = Util.Order.OrderUtil.filterMenuItem(oi); side si = Util.Order.OrderUtil.filterSide(oi); OrderItemVM orderItemVM = new OrderItemVM(oi, mi, si); orderVM.addItem(orderItemVM); } } return View("ViewFromSession",orderVM); }