Exemplo n.º 1
0
        public ActionResult <LiveBlackjackGame> Detail(string id)
        {
            var game = _blackJackDAL.GetGame(id);

            if (game != null)
            {
                return(Ok(game));
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 2
0
        public ActionResult <PlayerAccount> Join(string gameId, string playerName, int seatNo)
        {
            try
            {
                var game = _blackJackDAL.GetGame(gameId);
                if (game == null)
                {
                    return(NotFound("Game not found"));
                }
                double balance = 1000;

                var account = new PlayerAccount(
                    id: Guid.NewGuid().ToString().Replace("-", ""),
                    startingBalance: balance);

                game.AddPlayer(account, playerName, seatNo);
                _blackJackDAL.SaveGame(game);
                return(Ok(account));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Exemplo n.º 3
0
 private LiveBlackjackGame GetGame(string gameId)
 {
     return(_blackJackDAL.GetGame(gameId));
 }