public IActionResult Act(string act) { Dachi dachi = HttpContext.Session.GetObjectFromJson <Dachi>("dachi"); if (act == "Feed") { TempData["message"] = dachi.feeding(); } if (act == "Play") { TempData["message"] = dachi.playing(); } if (act == "Work") { TempData["message"] = dachi.working(); } if (act == "Sleep") { TempData["message"] = dachi.sleeping(); } if (act == "Restart?") { HttpContext.Session.Clear(); dachi = new Dachi(); } string done = dachi.isDone(); if (done == "win") { TempData["done"] = "true"; TempData["message"] = "Congratulations! You won!"; } else if (done == "dead") { TempData["done"] = "true"; TempData["message"] = "Your dachi ded"; } else { TempData["done"] = "false"; } HttpContext.Session.SetObjectAsJson("dachi", dachi); return(RedirectToAction("Index")); }