Esempio n. 1
0
 //
 // GET: /Order/
 public OrderController()
 {
     im = new OrderIM(db);
     om = new OrderOM(db);
     order_itemOM = new Order_ItemOM(db);
     menu_itemOM = new MenuItemOM(db);
 }
Esempio n. 2
0
 public BillController()
 {
     im = new BillIM(db);
     om = new BillOM(db);
     orderIM = new OrderIM(db);
     orderOM = new OrderOM(db);
     order_itemIM = new Order_ItemIM(db);
     order_itemOM = new Order_ItemOM(db);
 }
Esempio n. 3
0
        //
        // GET: /Review/Create
        public ActionResult Create(int orderID)
        {
            ReviewVM reviewVM;
            review review = new review();
            OrderIM oim = new OrderIM(db);

            user authUser = Util.User.UserUtil.getAuthenticatedUser(Request);

            if (authUser == null)
            {
                return RedirectToAction("Index", "User");
            }
            review.user_id = authUser.id;

            // Look for a valid order before we continue
            order order = oim.find(orderID);
            if (order == null)
            {
                return RedirectToAction("Index", "User");
            }
            review.order_id = order.id;
            if (order.table != null)
            {
                review.restaurant_id = order.table.restaurant_id.Value;
            }
            else
            {
                //TODO: this must be fixed after CAP-480
                review.restaurant_id = db.restaurants.First().id;
            }
            reviewVM = new ReviewVM(review, order);
            Session.Add(Global.ReviewVMSession, reviewVM);
            ViewBag.ratings = new SelectList(Rating.GetRatings(), "Value", "Text");

            return View(reviewVM);
        }
Esempio n. 4
0
        public Boolean edit(order order)
        {
            OrderIM im = new OrderIM(db);
            order dbVersion = im.find(order.id);
            if (dbVersion.version == order.version)
            {
                ((IObjectContextAdapter)db).ObjectContext.Detach(dbVersion);
                db.Entry(order).State = EntityState.Modified;

                order.version = order.version + 1;
                db.SaveChanges();
                return true;
            }
            return false;
        }
Esempio n. 5
0
 private JsonResult GetOrderItemData(int orderID)
 {
     OrderIM oim = new OrderIM(db);
     order o = oim.find(orderID);
     List<order_item> orderItems = new List<order_item>();
     foreach (order_item oi in o.order_item)
     {
         orderItems.Add(oi);
     }
     return Json(orderItems);
 }