public double WinningPercentage(string teamName) { return(GamesPlayed.Where(t => (t.AwayTeam == teamName && t.AwayScore > t.HomeScore) || (t.HomeTeam == teamName && t.HomeScore > t.AwayScore)) .Count() * 1.0 / GamesPlayed.Where(t => t.AwayTeam == teamName || t.HomeTeam == teamName) .Count() * 1.0); }
public IEnumerable <Game> GamesPlayedByTeam(string teamName) { return(GamesPlayed.Where(g => g.AwayTeam == teamName || g.HomeTeam == teamName)); }