Пример #1
0
        private async Task Save(MusicLibraryData data)
        {
            using (var uow = new UnitOfWork())
            {
                await context.AlbumRepository.Save(data.Albums.ToList());

                await context.ArtistRepository.Save(data.Artists.ToList());

                await context.GenreRepository.Save(data.Genres.ToList());

                await context.TrackRepository.Save(data.Tracks.ToList());

                await context.TrackGenreRepository.Save(data.TrackGenres.ToList());

                await context.AlbumArtistRepository.Save(data.AlbumArtists.ToList());

                await context.TrackArtistRepository.Save(data.TrackArtists.ToList());

                await context.MusicFileRepository.Save(data.MusicFiles.ToList());

                await context.TrackFileRepostiory.Save(data.TrackFiles.ToList());

                uow.Complete();
            }
        }
Пример #2
0
        public async Task SaveAsync(List <TrackInfoResult> trackInfoResults)
        {
            var libraryData = new MusicLibraryData(driveServiceFactory);
            await libraryData.BuildDataAsync(trackInfoResults);

            await Save(libraryData);
        }