public Tuple <Team, Team> GetFirstAndSecondFromGroup(WorldCup2014Table.Group group) { var temp = new Team[2]; return(GetPointsFromGroup(group) .OrderByDescending(x => x.Points) .ThenByDescending(x => x.GoalsFor - x.GoalsAgainst) .ThenByDescending(x => x.Wins) .Take(2) .Aggregate ( 0, (acc, x) => { temp[acc++] = x.Team; return acc; }, acc => Tuple.Create(temp[0], temp[1]) )); }
public IEnumerable <PointInfo> GetPointsFromGroup(WorldCup2014Table.Group group) { return(Points.Join(Table.GetTeamsFromGroup(group), x => x.Team, y => y, (x, y) => x)); }