You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/NzbDrone.Core/MediaFiles/MediaFileRepository.cs

35 lines
1.0 KiB

using System.Collections.Generic;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;
11 years ago
namespace NzbDrone.Core.MediaFiles
{
public interface IMediaFileRepository : IBasicRepository<EpisodeFile>
{
List<EpisodeFile> GetFilesBySeries(int seriesId);
List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber);
}
public class MediaFileRepository : BasicRepository<EpisodeFile>, IMediaFileRepository
{
public MediaFileRepository(IDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
{
}
public List<EpisodeFile> GetFilesBySeries(int seriesId)
{
return Query.Where(c => c.SeriesId == seriesId).ToList();
}
public List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber)
{
return Query.Where(c => c.SeriesId == seriesId)
.AndWhere(c => c.SeasonNumber == seasonNumber)
.ToList();
}
}
}