From e4c9e11ee1197b30e26de3da960a74cdaffebc35 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 11 May 2011 08:21:09 -0700 Subject: [PATCH] Deleting a series will also delete all items in history for that series. --- NzbDrone.Core/Providers/SeriesProvider.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 7db3f3142..07ae9573c 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -128,6 +128,10 @@ public virtual void DeleteSeries(int seriesId) //Delete Files, Episdes, Seasons then the Series //Can't use providers because episode provider needs series provider - Cyclic Dependency Injection, this will work + Logger.Debug("Deleting History Items from DB for Series: {0}", series.SeriesId); + var episodes = series.Episodes.Select(e => e.EpisodeId).ToList(); + episodes.ForEach(e => _repository.DeleteMany(h => h.EpisodeId == e)); + Logger.Debug("Deleting EpisodeFiles from DB for Series: {0}", series.SeriesId); _repository.DeleteMany(series.EpisodeFiles);