public ActionResult <LiveBlackjackGame> Detail(string id) { var game = _blackJackDAL.GetGame(id); if (game != null) { return(Ok(game)); } else { return(NotFound()); } }
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)); } }
private LiveBlackjackGame GetGame(string gameId) { return(_blackJackDAL.GetGame(gameId)); }