Example #1
0
        public IActionResult dachi(string button)
        {
            Dachi meep = HttpContext.Session.GetObjectFromJson <Dachi>("dachi");

            if (button == "Feed")
            {
                meep.feed(meep);
                List <string> check = meep.status(meep);
                if (check.Contains("fine"))
                {
                    HttpContext.Session.SetObjectAsJson("dachi", meep);
                    return(RedirectToAction("page"));
                }
                else if (check.Contains("win"))
                {
                    return(View("win"));
                }
                else if (check.Contains("dead"))
                {
                    return(View("dead"));
                }
            }
            else if (button == "Play")
            {
                meep.play(meep);
                List <string> check = meep.status(meep);
                if (check.Contains("fine"))
                {
                    HttpContext.Session.SetObjectAsJson("dachi", meep);
                    return(RedirectToAction("page"));
                }
                else if (check.Contains("win"))
                {
                    return(View("win"));
                }
                else if (check.Contains("dead"))
                {
                    return(View("dead"));
                }
            }
            else if (button == "Work")
            {
                meep.work(meep);
                List <string> check = meep.status(meep);
                if (check.Contains("fine"))
                {
                    HttpContext.Session.SetObjectAsJson("dachi", meep);
                    return(RedirectToAction("page"));
                }
                else if (check.Contains("win"))
                {
                    return(View("win"));
                }
                else if (check.Contains("dead"))
                {
                    return(View("dead"));
                }
            }
            else if (button == "Sleep")
            {
                meep.sleep(meep);
                List <string> check = meep.status(meep);
                if (check.Contains("fine"))
                {
                    HttpContext.Session.SetObjectAsJson("dachi", meep);
                    return(RedirectToAction("page"));
                }
                else if (check.Contains("win"))
                {
                    return(View("win"));
                }
                else if (check.Contains("dead"))
                {
                    return(View("dead"));
                }
            }

            return(View("index"));
        }