public LeagueTeam(League league, Team team) { if (league == null) throw new ArgumentNullException(nameof(league)); if (team == null) throw new ArgumentNullException(nameof(team)); League = league; Team = team; Statistics = new TeamStatistics(); }
public TeamStatistics GetFullStatistics() { var res = new TeamStatistics(); foreach (var league in Leagues) { var team = league.Teams.FirstOrDefault(x => x.Team.ID == ID); if (team == null) throw new InvalidOperationException("Team is not in league"); res += team.Statistics; } return res; }