diff --git a/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsRepository.cs b/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsRepository.cs index 35689b679..7846cb0f3 100644 --- a/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsRepository.cs +++ b/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsRepository.cs @@ -15,6 +15,7 @@ namespace NzbDrone.Core.NetImport.ImportExclusions public interface IImportExclusionsRepository : IBasicRepository { bool IsMovieExcluded(int tmdbid); + ImportExclusion GetByTmdbid(int tmdbid); } public class ImportExclusionsRepository : BasicRepository, IImportExclusionsRepository @@ -31,5 +32,10 @@ public bool IsMovieExcluded(int tmdbid) { return Query.Where(ex => ex.TmdbId == tmdbid).Any(); } + + public ImportExclusion GetByTmdbid(int tmdbid) + { + return Query.Where(ex => ex.TmdbId == tmdbid).First(); + } } } diff --git a/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsService.cs b/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsService.cs index 34ff8125d..db289f344 100644 --- a/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsService.cs +++ b/src/NzbDrone.Core/NetImport/ImportExclusions/ImportExclusionsService.cs @@ -47,6 +47,10 @@ public ImportExclusionsService(IImportExclusionsRepository exclusionRepository, public ImportExclusion AddExclusion(ImportExclusion exclusion) { + if (_exclusionRepository.IsMovieExcluded(exclusion.TmdbId)) + { + return _exclusionRepository.GetByTmdbid(exclusion.TmdbId); + } return _exclusionRepository.Insert(exclusion); }