Exemple #1
0
        /// <summary>
        /// Handles new game action and redirect to game page.
        /// </summary>
        /// <returns>Redirects to Game page after updating game state.</returns>
        public IActionResult NewGame()
        {
            var session = new GameOfPigSession(HttpContext.Session);

            session.SetPigGame(new PigGame());

            return(RedirectToAction("Index"));
        }
Exemple #2
0
        /// <summary>
        /// Handles user hold action and redirects to game page.
        /// </summary>
        /// <returns>Redirect to Game Page after updating game state.</returns>
        public IActionResult Hold()
        {
            var session = new GameOfPigSession(HttpContext.Session);

            var pigGame = session.GetPigGame();

            pigGame.UserHold();
            session.SetPigGame(pigGame);

            return(RedirectToAction("Index"));
        }