public async Task RemovePlayer(Guid roundId, Player player) { var round = await _gameRoundRepository.Get(roundId); if (round == null) { throw new Exception("Раунд не найден"); } if (round.State == GameRoundState.Active && round.Start.HasValue) { var rating = await _gameDataRepository.GetRating(); if (rating.Any(r => r.PlayerId == player.PlayerId && r.Points > 0)) { throw new Exception("Нельзя удалить игрока из запущенного раунда, если по нему пришли данные!"); } } if (round.Players.Any(p => p.PlayerId == player.PlayerId)) { var players = round.Players.ToList(); var playerInList = players.Find(p => p.PlayerId == player.PlayerId); players.Remove(playerInList); round.Players = players; await _gameRoundRepository.Update(round); } }