public List <Resultat> ObtenirLesResultats(int idSondage) { List <Resto> restaurants = ObtenirTousLesRestaurants(); List <Resultat> resultats = new List <Resultat>(); Sondage sondage = listeDesSondages.First(s => s.Id == idSondage); foreach (IGrouping <int, Vote> grouping in sondage.Votes.GroupBy(v => v.Resto.Id)) { int idRestaurant = grouping.Key; Resto resto = restaurants.First(r => r.Id == idRestaurant); int nombreDeVotes = grouping.Count(); resultats.Add(new Resultat { Nom = resto.Nom, Telephone = resto.Telephone, Score = nombreDeVotes }); } return(resultats); }