コード例 #1
0
        // GET: Topping/Details/5
        public ActionResult ToppingDetails(int id)
        {
            var topping = db1.GetToppingByToppingId(id);

            t             = new Models.Topping();
            t.ToppingName = topping.ToppingName;
            t.Count       = topping.Count;

            toppingList.Add(t);

            return(View(t));
        }
コード例 #2
0
        // GET: Toppings
        public ActionResult ToppingIndex()
        {
            var toppings = db1.GetTopping();

            foreach (var topping in toppings)
            {
                t             = new Models.Topping();
                t.ToppingName = topping.ToppingName;
                t.Count       = topping.Count;

                toppingList.Add(t);
            }

            return(View(toppingList));
        }
コード例 #3
0
        public ActionResult ToppingsPage(int ptid)
        {
            var toppings = db.GetToppings();

            ViewBag.PTID      = ptid;
            ViewBag.PTIDOrder = db.GetPizzaByPizzaid(ptid).Porderid;
            foreach (var topping in toppings)
            {
                t           = new Models.Topping();
                t.Toppingid = topping.Toppingid;
                t.Tpizzaid  = topping.Tpizzaid;
                t.Topping1  = topping.Topping1;
                t.Numt++;
                ToppingList.Add(t);
            }
            return(View(ToppingList));
        }
コード例 #4
0
        public ActionResult Create(IFormCollection collection, Models.Topping topping)
        {
            try
            {
                // TODO: Add insert logic here
                PizzaProject1.Library.Topping dmc = new Topping();
                dmc.ToppingId   = topping.ToppingId;
                dmc.ToppingName = topping.ToppingName;

                //return RedirectToAction(nameof(Index));
                return(View());
            }
            catch
            {
                return(View());
            }
        }
コード例 #5
0
        public ActionResult OrdersPreview(int uoid)
        {
            ViewBag.Message = "Welcome to my demo!";
            dynamic mymodel = new ExpandoObject();
            //mymodel.Orders = db.GetOrders();
            //mymodel.Pizzas = db.GetPizzas();
            //mymodel.Toppings = db.GetToppings();
            var orderps   = db.GetOrders();
            var pizzaps   = db.GetPizzas();
            var toppingps = db.GetToppings();

            foreach (var toppingp in toppingps)
            {
                t           = new Models.Topping();
                t.Toppingid = toppingp.Toppingid;
                t.Tpizzaid  = toppingp.Tpizzaid;
                t.Topping1  = toppingp.Topping1;
                t.Numt++;
                ToppingList.Add(t);
            }
            foreach (var pizzap in pizzaps)
            {
                p          = new Models.Pizza();
                p.Pizzaid  = pizzap.Pizzaid;
                p.Size     = pizzap.Size;
                p.Crust    = pizzap.Crust;
                p.Cost     = pizzap.Cost;
                p.Porderid = pizzap.Porderid;
                p.Nump++;
                PizzaList.Add(p);
            }
            foreach (var orderp in orderps)
            {
                o             = new Models.Order();
                o.Orderid     = orderp.Orderid;
                o.Ocustomerid = orderp.Ocustomerid;
                o.Datetime    = orderp.Datetime;
                o.Numo++;
                OrderList.Add(o);
            }
            mymodel.Toppings = ToppingList;
            mymodel.Pizzas   = PizzaList;
            mymodel.Orders   = OrderList;
            return(View(mymodel));
        }
コード例 #6
0
 public ActionResult CreateTopping(IFormCollection collection, Models.Topping topping)
 {
     PizzaBox.Domain.Topping dmt = new Topping();
     dmt.Toppingid = topping.Toppingid;
     dmt.Tpizzaid  = topping.Tpizzaid;
     dmt.Topping1  = topping.Topping1;
     try
     {
         db.AddTopping(dmt);
         db.Save();
         return(RedirectToAction(nameof(CreateTopping), new { pid = topping.Tpizzaid }));
         //return RedirectToAction(nameof(ToppingsPage));
     }
     catch
     {
         return(View());
     }
 }