Esempio n. 1
0
        public async Task <PlaylistDto> CreateAsync(PlaylistDto item)
        {
            var result = _context.Playlists.Add(PlaylistConverter.Convert(item));
            await _context.SaveChangesAsync();

            return(PlaylistConverter.Convert(result.Entity));
        }
Esempio n. 2
0
        public async Task <PlaylistViewModel> GetPlaylistByIdAsync(int id,
                                                                   CancellationToken ct = default(CancellationToken))
        {
            var playlistViewModel = PlaylistConverter.Convert(await _playlistRepository.GetByIdAsync(id, ct));

            playlistViewModel.Tracks = await GetTrackByPlaylistIdIdAsync(playlistViewModel.PlaylistId, ct);

            return(playlistViewModel);
        }
Esempio n. 3
0
        public async Task <bool> UpdateAsync(PlaylistDto item)
        {
            if (item == null)
            {
                return(false);
            }
            _context.Playlists.Update(PlaylistConverter.Convert(item));
            await _context.SaveChangesAsync();

            return(true);
        }
        private void Generate(string name)
        {
            //PlaylistInfo
            var item = project.LibraryGroups[0].Playlists.GetByName(name);

            //Serialiser object
            Serialiser <PlaylistType> _ser = Serialiser <PlaylistType> .Xml;

            //Playlist Converter
            PlaylistConverter converter = new PlaylistConverter();

            //UFE Playlist
            PlaylistType ufeItem = converter.Convert(item);

            //Serialize playlist
            _ser.Serialize(ufeItem, LocalFilePathMapping.GetFile(FileType.Playlist, ufeItem.Id));
        }
Esempio n. 5
0
        public async Task <PlaylistDto> GetByIdAsync(Guid id)
        {
            var playlist = PlaylistConverter.Convert(await _context.Playlists.FindAsync(id));

            return(playlist);
        }
Esempio n. 6
0
 public async Task <List <PlaylistDto> > GetAllAsync()
 {
     return(PlaylistConverter.Convert(await _context.Playlists.ToListAsync()));
 }