Example #1
0
        public IActionResult Index(CustomerViewModel model)
        {
            Console.WriteLine(model.CustomerName);

            if (model.GetCustomerId() > 0)
            {
                HttpContext.Session.SetString("CustomerName", model.CustomerName);
                HttpContext.Session.SetInt32("CustomerID", model.GetCustomerId());

                ViewBag.PizzaProblem = "";
                HttpContext.Session.SetInt32("CostOfOrder", 0);
                HttpContext.Session.SetInt32("InventoryProblem", 0);

                return(RedirectToAction("Index", "Order"));
            }
            else
            {
                ViewBag.CustomerNameProblem = "Name entered not in database or Invalid";
                return(View(new CustomerViewModel()));
            }
        }