public void loadToGame(Game game, long protocol) { string betsString = endpoint.obterTodasDezenasApostadas(protocol); if (betsString == null) { throw new GameNotFound(); } game.protocol = protocol; var bets = betsString.Split(',').Select(betString => betRepo.find(betString)); foreach (var bet in bets) { game.AddBetNumber(bet); } try { var winResult = getWinnerResult(); game.winnerResult = winResult; } catch (GameResultNotFound) { game.winnerResult = null; } }
public void AddBet(string betNumber) { BetNumber bet = betRepo.find(betNumber); game.AddBetNumber(bet); }