public List <Player> getYellowCardsForAllPlayer() { var players = GetCollections.getPlayerCollection(); var yCards = GetCollections.getYellowCardCollection(); return((players.Select(p => { p.yellowCards = yCards.Count(b => b.playerId == p.Id); return p; })).OrderByDescending(pp => pp.yellowCards).ToList()); }
private void Page_Loaded(object sender, RoutedEventArgs e) { List <Player> yellowCardsPlayersDescending2 = (GetCollections.getPlayerCollection().Select(p => { p.yellowCards = GetCollections.getYellowCardCollection().Count(b => b.playerId == p.Id); return(p); })).OrderByDescending(pp => pp.yellowCards).ToList(); }