예제 #1
0
        private List <Album> GetTopSellingAlbums(int count)
        {
            // Group the order details by album and return
            // the albums with the highest count

            //Calling the database
            //return storeDB
            //    .OrderByDescending(a => a.OrderDetails.Count())
            //    .Take(count)
            //    .ToList();

            //Calling the repository
            //return _albumsRepository.Get()
            //    .OrderByDescending(a => a.OrderDetails.Count())
            //    .Take(count)
            //    .ToList();

            //encapsulating the logic in the repository
            return(_albumsRepository.GetTopSellingAlbums(count).ToList());
        }