public async Task <TakeCardRoundView> TakeCard(long gameId) { List <GamePlayer> players = await _gamePlayerRepository.GetAllByGameId(gameId); await DistributeCards(players, CardValue.OneCardPerPlayer, false); CountCardScoreForPlayers(players); await _gamePlayerRepository.UpdateMany(players); string roundResult = GameMessage.RoundInProcess; GamePlayer human = players.Where(m => m.Player.Type == PlayerType.Human).First(); if (human.CardScore >= CardValue.MaxCardScore) { GamePlayer dealer = players.Where(m => m.Player.Type == PlayerType.Dealer).First(); await DistributeEndCardsForDealer(dealer); roundResult = GetRoundResult(human, dealer); Game game = CustomMapper.MapGame(gameId, roundResult); await _gameRepository.Update(game); await _historyMessageManager.AddMessagesForRound(players, roundResult, gameId); } TakeCardRoundView view = CustomMapper.MapTakeCardRoundView(players, roundResult); return(view); }