예제 #1
0
        private List <ManualImportResource> UpdateImportItems(List <ManualImportResource> resources)
        {
            var items = new List <ManualImportItem>();

            foreach (var resource in resources)
            {
                items.Add(new ManualImportItem
                {
                    Id                      = resource.Id,
                    Path                    = resource.Path,
                    Name                    = resource.Name,
                    Size                    = resource.Size,
                    Author                  = resource.Author == null ? null : _authorService.GetAuthor(resource.Author.Id),
                    Book                    = resource.Book == null ? null : _bookService.GetBook(resource.Book.Id),
                    Edition                 = resource.EditionId == 0 ? null : _editionService.GetEdition(resource.EditionId),
                    Quality                 = resource.Quality,
                    DownloadId              = resource.DownloadId,
                    AdditionalFile          = resource.AdditionalFile,
                    ReplaceExistingFiles    = resource.ReplaceExistingFiles,
                    DisableReleaseSwitching = resource.DisableReleaseSwitching
                });
            }

            return(_manualImportService.UpdateItems(items).Select(x => x.ToResource()).ToList());
        }
예제 #2
0
        private List <ManualImportResource> UpdateImportItems(List <ManualImportResource> resources)
        {
            var items = new List <ManualImportItem>();

            foreach (var resource in resources)
            {
                items.Add(new ManualImportItem {
                    Id                      = resource.Id,
                    Path                    = resource.Path,
                    RelativePath            = resource.RelativePath,
                    Name                    = resource.Name,
                    Size                    = resource.Size,
                    Artist                  = resource.Artist == null ? null : _artistService.GetArtist(resource.Artist.Id),
                    Album                   = resource.Album == null ? null : _albumService.GetAlbum(resource.Album.Id),
                    Release                 = resource.AlbumReleaseId == 0 ? null : _releaseService.GetRelease(resource.AlbumReleaseId),
                    Quality                 = resource.Quality,
                    DownloadId              = resource.DownloadId,
                    AdditionalFile          = resource.AdditionalFile,
                    ReplaceExistingFiles    = resource.ReplaceExistingFiles,
                    DisableReleaseSwitching = resource.DisableReleaseSwitching
                });
            }

            return(_manualImportService.UpdateItems(items).Select(x => x.ToResource()).ToList());
        }