Beispiel #1
0
        public IActionResult Process(string Activity)
        {
            Dachi curDachi = HttpContext.Session.GetObjectFromJson <Dachi>("dachi");

            if (Activity == "Feed")
            {
                curDachi.feed();
                System.Console.WriteLine("Hello");
            }
            else if (Activity == "Work")
            {
                curDachi.work();
            }
            else if (Activity == "Play")
            {
                curDachi.play();
            }
            else if (Activity == "Sleep")
            {
                curDachi.sleep();
            }
            HttpContext.Session.SetObjectAsJson("dachi", curDachi);
            // ViewBag.dachi = curDachi;
            return(RedirectToAction("Index"));
        }
        public IActionResult Feed()
        {
            Dachi DachiCurrent = HttpContext.Session.GetObjectFromJson <Dachi>("DachiNew");

            if (DachiCurrent.meals > 0)
            {
                DachiCurrent.feed();
            }
            HttpContext.Session.SetObjectAsJson("DachiNew", DachiCurrent);
            return(RedirectToAction("Index"));
        }