public IActionResult Dontdie(string activity) { // GetHashCode current state DemoDachi current_critter = HttpContext.Session.GetObjectFromJson <DemoDachi>("dachi"); // figure out what to do if (activity == "feed") { current_critter.feed(); _mydachi.feed(); System.Console.WriteLine(_mydachi.fullness); } // do that thing // update state and go! HttpContext.Session.SetObjectAsJson("dachi", current_critter); return(RedirectToAction("Index")); }
public DachiController() { _mydachi = new DemoDachi(); }