public IActionResult Play() { _snakeEyes = HttpContext.Session.GetObject <SnakeEyes>("SnakeEyes"); _snakeEyes.Play(); HttpContext.Session.SetObject("SnakeEyes", _snakeEyes); return(View("Index", _snakeEyes)); }
public IActionResult Play() { _snakeEyes = JsonConvert.DeserializeObject <SnakeEyes>(HttpContext.Session.GetString("SnakeEye")); _snakeEyes.Play(); HttpContext.Session.SetString("SnakeEye", JsonConvert.SerializeObject(_snakeEyes)); return(View("Index", _snakeEyes)); }
public IActionResult Play() { _snakeEyes = HttpContext.Session.GetObject <SnakeEyes>("SnakeEyes"); _highscore = HttpContext.Session.GetObject <int>("Highscore"); _snakeEyes.Play(); _highscore = _snakeEyes.Total > _highscore ? _snakeEyes.Total : _highscore; ViewBag.Highscore = _highscore; HttpContext.Session.SetObject("Highscore", _highscore); HttpContext.Session.SetObject("SnakeEyes", _snakeEyes); return(View("Index", _snakeEyes)); }