public List <PlayerDto> FindPlayers() { List <PlayerDto> result = new List <PlayerDto>(); //List<FactionPlayer> collection = _factionPlayerService.GetAll(); List <Player> players = _playerService.GetAllPlayers(); foreach (Player player in players) { PlayerDto playerDto = _playerConverter.convert(_playerService.FindById(player.Id)); try { FactionPlayer factionPlayer = _factionPlayerService.FindByPlayerId(player.Id); playerDto.Faction = _factionService.FindById(factionPlayer.FactionId); } ///TODO переделать catch ошибки на конкретную catch (Exception e) { playerDto.Faction = null; } result.Add(playerDto); } return(result); }
public FactionDto FindById(int id) { return(_factionConverter.convert(_factionService.FindById(id))); }