예제 #1
0
        public List <RoundViewModel> GetRoundsViewModel(int gameId)
        {
            var roundViewModels = new List <RoundViewModel>();
            var rounds          = _roundService.GetRounds(gameId);

            foreach (Round round in rounds)
            {
                var playersId      = _roundService.GetPlayersId(gameId).ToList();
                var roundViewModel = new RoundViewModel
                {
                    Round   = round,
                    Players = _gameService.GetNamePlayers(playersId),
                    Scores  = _roundService.GetScoresByRoundId(gameId, round.Id),
                    IsWins  = _roundService.GetIsWinsByRound(gameId, round.Id),
                    Cards   = _roundService.GetCardsByRound(gameId, round.Id)
                };
                roundViewModels.Add(roundViewModel);
            }
            return(roundViewModels);
        }