Beispiel #1
0
        public IEnumerable <Movie> SelectTopFiveMovies()
        {
            var averageRatings = _movieRatingRepository.GetRatings()
                                 .GroupBy(m => m.MovieId)
                                 .Select(g => new MovieRating {
                MovieId = g.Key, Rating = g.Average(r => r.Rating)
            });

            return(SortTopMovies(averageRatings).Take(5));
        }