public PlayerStatsViewModel GetCards() { var gameId = _gameService.GetCurrentGameId(_playerName); if (gameId < 0) { return(null); } var playerStatsViewModel = new PlayerStatsViewModel(); var cards = new List <List <byte> >(); var flags = _roundService.GetFlagsIsGiveCard(gameId, true).ToList(); var cardsLine = _roundService.GetCardsForPlayers(gameId, flags).ToList(); for (int i = 0; i < cardsLine.Count(); i++) { if (cards.Count() < cardsLine.Count()) { cards.Add(new List <byte>()); } cards[i].Add(cardsLine[i]); } playerStatsViewModel.Scores = _roundService.GetScores(gameId).ToList(); flags = _roundService.GetFlagsIsGiveCard(gameId, playerStatsViewModel.Scores[0] < 20).ToList(); playerStatsViewModel.Cards = cards; playerStatsViewModel.IsFinishedRound = _roundService.GetIsRoundFinished(gameId, flags); return(playerStatsViewModel); }