Beispiel #1
0
        public ActionResult Update(int tableOrderId, int dishId, int quantity)
        {
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.UpdateDish(dishId, quantity);
            return(RedirectToAction("Show"));
        }
Beispiel #2
0
        public ActionResult Update(int tableOrderId, string tableNumber, DateTime orderDate)
        {
            TableOrder foundTableOrder = TableOrder.Find(tableOrderId);

            foundTableOrder.Edit(tableNumber, orderDate);
            return(RedirectToAction("Show"));
        }
Beispiel #3
0
        public ActionResult Create(int tableOrderId, int dishId, int newDishQuantity)
        {
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.AddDish(dishId, newDishQuantity);
            return(RedirectToAction("Show"));
        }
Beispiel #4
0
        public ActionResult Delete(int tableOrderId)
        {
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.Delete();
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public ActionResult Delete(int tableOrderId, int dishId)
        {
            Console.WriteLine(" Delete: {0} {1}", tableOrderId, dishId);
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.DeleteDish(dishId);
            return(RedirectToAction("Show"));
        }
Beispiel #6
0
        public ActionResult Show(int tableOrderId)
        {
            TableOrder foundOrder             = TableOrder.Find(tableOrderId);
            Dictionary <string, object> model = new Dictionary <string, object>();

            model["order"]        = foundOrder;
            model["order_dishes"] = foundOrder.GetAllDishes();
            model["all_dishes"]   = foundOrder.GetPotentialDishes();//Dish.GetAll();
            return(View(model));
        }
Beispiel #7
0
        public void Find_FindsOrderInDatabase_Order()
        {
            string     tableNumber = "4";
            DateTime   orderDate   = new DateTime(2019, 3, 12);
            TableOrder newOrder    = new TableOrder(tableNumber, orderDate);

            newOrder.Save();

            int        id        = newOrder.GetId();
            TableOrder testOrder = TableOrder.Find(id);

            Assert.AreEqual(newOrder, testOrder);
        }
Beispiel #8
0
        public ActionResult Edit(int tableOrderId)
        {
            TableOrder foundTableOrder = TableOrder.Find(tableOrderId);

            return(View(foundTableOrder));
        }