mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 03:52:33 +02:00
Fixed: Error when adding an already excluded movie to the exclusion list.
Fixes #2462
This commit is contained in:
parent
eb1c3c8b82
commit
aab14d02f9
@ -15,6 +15,7 @@ namespace NzbDrone.Core.NetImport.ImportExclusions
|
||||
public interface IImportExclusionsRepository : IBasicRepository<ImportExclusion>
|
||||
{
|
||||
bool IsMovieExcluded(int tmdbid);
|
||||
ImportExclusion GetByTmdbid(int tmdbid);
|
||||
}
|
||||
|
||||
public class ImportExclusionsRepository : BasicRepository<ImportExclusion>, 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user