SeasonProvider GetLatestSeason added

pull/6/head
markus101 14 years ago
parent 57f5b3ddc2
commit ac20da426b

@ -7,6 +7,7 @@ namespace NzbDrone.Core.Providers
{ {
Season GetSeason(int seasonId); Season GetSeason(int seasonId);
List<Season> GetSeasons(int seriesId); List<Season> GetSeasons(int seriesId);
Season GetLatestSeason(int seriesId);
void EnsureSeason(int seriesId, int seasonId, int seasonNumber); void EnsureSeason(int seriesId, int seasonId, int seasonNumber);
int SaveSeason(Season season); int SaveSeason(Season season);
bool IsIgnored(int seasonId); bool IsIgnored(int seasonId);

@ -27,6 +27,11 @@ namespace NzbDrone.Core.Providers
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).ToList(); return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).ToList();
} }
public Season GetLatestSeason(int seriesId)
{
return _sonicRepo.All<Season>().Where(s => s.SeriesId == seriesId).OrderBy(s => s.SeasonNumber).Last();
}
public void EnsureSeason(int seriesId, int seasonId, int seasonNumber) public void EnsureSeason(int seriesId, int seasonId, int seasonNumber)
{ {
if (_sonicRepo.Exists<Season>(s => s.SeasonId == seasonId)) if (_sonicRepo.Exists<Season>(s => s.SeasonId == seasonId))

Loading…
Cancel
Save