public async Task <EndRoundView> End(long gameId) { List <GamePlayer> players = await _gamePlayerRepository.GetAllByGameId(gameId); GamePlayer human = players.Where(m => m.Player.Type == PlayerType.Human).First(); GamePlayer dealer = players.Where(m => m.Player.Type == PlayerType.Dealer).First(); await DistributeEndCardsForDealer(dealer); string roundResult = GetRoundResult(human, dealer); Game game = CustomMapper.MapGame(gameId, roundResult); await _gameRepository.Update(game); await _historyMessageManager.AddMessagesForRound(players, roundResult, gameId); EndRoundView view = CustomMapper.MapEndRoundView(dealer, roundResult); return(view); }