Exemple #1
0
        public async Task <MediaItem> GetMediaItemByIdAsync(int id)
        {
            using (_busyStack.GetToken())
            {
                var item = await _mediaItemRepository.GetByIdAsync(id)
                           .ConfigureAwait(true);

                return(_mediaItemMapper.Get(item));
            }
        }
Exemple #2
0
        public IList <Playlist> GetAllPlaylists()
        {
            var playlists  = _context.Playlists.AsEnumerable().Select(p => _playlistMapper.Get(p)).ToList();
            var mediaItems = _context.MediaItems.AsEnumerable().Select(p => _mediaItemMapper.Get(p)).ToList();

            foreach (var playlist in playlists)
            {
                playlist.AddRange(mediaItems.Where(p => p.PlaylistId == playlist.Id));
            }

            return(playlists);
        }
Exemple #3
0
 public static IEnumerable <MediaItem> GetMany(this IMediaItemMapper mapper, IEnumerable <Data.MediaItem> items, int playlistId)
 {
     return(items.ForEach(p =>
     {
         var item = mapper.Get(p);
         item.PlaylistId = playlistId;
         return item;
     }));
 }