public async Task <IActionResult> RestartGame(RestartGameRequest restartGameRequest)
        {
            if (game.GameState != GameState.GameOver)
            {
                return(BadRequest("Game not in gameover state"));
            }
            if (config["secretCode"] != restartGameRequest.SecretCode)
            {
                return(BadRequest("Secret code doesn't match, unable to restart game."));
            }
            game.Restarting();

            return(Ok());
        }
示例#2
0
        public IActionResult RestartGame(StartGameRequest startGameRequest)
        {
            if (game.GameState != GameState.GameOver)
            {
                return(BadRequest("Game not finished"));
            }
            if (config["secretCode"] != startGameRequest.SecretCode)
            {
                return(BadRequest("Secret code doesn't match, unable to start game."));
            }

            game.Restarting();

            return(Ok());
        }