public async Task <Team> GetTeamById(int id, string userId) { var team = await _repository.GetById(id); if (team == null) { return(null); } var teamPlayers = await _playersRepository.GetAllByTeamId(id); team.Players = teamPlayers.ToList(); return(team.ApplicationUserId == userId ? team : null); }
public async Task <ICollection <Player> > GetPlayersByTeamId(int teamId) { var teamPlayers = await _repository.GetAllByTeamId(teamId); return(teamPlayers); }