public GameViewModel GetLastRoundInfo() { Game game = _gameRepository.GetContinueableGame(_userId); if (game == null) { throw new InvalidOperationException("Game is not found"); } List <RoundPlayer> lastRoundInfo = _roundPlayerRepository.GetLastRoundInfo(game.Id).ToList(); _cardRepository.FillRoundPlayersCards(lastRoundInfo); List <PlayerGameViewModel> players = Mapper.Map <List <RoundPlayer>, List <PlayerGameViewModel> >(lastRoundInfo); if (players[0].State == RoundPlayerState.None) { PlayerGameViewModel dealer = players[players.Count - 1]; dealer.Cards[1] = Constants.BlankCardCode; dealer.Score = 0; } var roundInfo = new GameViewModel { Players = players }; return(roundInfo); }
public GameViewModel GetRoundInfo(int gameSkipCount, int roundSkipCount) { long gameId = _gameRepository.GetGameIdBySkipCount(_userId, gameSkipCount); List <RoundPlayer> roundPlayers = _roundRepository.GetRoundInfo(gameId, roundSkipCount).ToList(); _cardRepository.FillRoundPlayersCards(roundPlayers); List <PlayerGameViewModel> players = Mapper.Map <List <RoundPlayer>, List <PlayerGameViewModel> >(roundPlayers); if (players[0].State == RoundPlayerState.None) { PlayerGameViewModel dealer = players[players.Count - 1]; dealer.Cards[1] = Constants.BlankCardCode; dealer.Score = 0; } var roundInfo = new GameViewModel { Players = players }; return(roundInfo); }