Example #1
0
        public IActionResult Game(string button = "New Game")
        {
            switch (button)
            {
            case "New Game":
                _gameState = _blackJackGameService.NewGame();
                break;

            case "Deal":
                _gameState = _blackJackGameService.Deal(10);
                break;

            case "Hit":
                _gameState = _blackJackGameService.Hit();
                break;

            case "Stand":
                _gameState = _blackJackGameService.Stand();
                break;

            default:
                _gameState = null;
                break;
            }

            if (_gameState == null)
            {
                return(View(_blackJackGameService.NewGame()));
            }

            return(View(_gameState));
        }
Example #2
0
        public GameState Get(string action, int bet = 0)
        {
            switch (action)
            {
            case "Deal":
                if (bet != 0)
                {
                    return(_blackJackGameService.Deal(bet));
                }
                break;

            case "Hit":
                return(_blackJackGameService.Hit());

            case "Stand":
                return(_blackJackGameService.Stand());

            case "NewGame":
            default:
                return(_blackJackGameService.NewGame());
            }

            return(_blackJackGameService.NewGame());
        }