2013-03-01 07:03:41 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using NzbDrone.Core.Datastore;
|
2013-09-11 06:33:47 +00:00
|
|
|
using NzbDrone.Core.Messaging;
|
2013-09-14 06:36:07 +00:00
|
|
|
using NzbDrone.Core.Messaging.Events;
|
2013-09-11 06:33:47 +00:00
|
|
|
|
2013-03-01 07:03:41 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.MediaFiles
|
|
|
|
{
|
|
|
|
public interface IMediaFileRepository : IBasicRepository<EpisodeFile>
|
|
|
|
{
|
|
|
|
List<EpisodeFile> GetFilesBySeries(int seriesId);
|
2013-07-19 05:23:04 +00:00
|
|
|
List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber);
|
2013-03-01 07:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class MediaFileRepository : BasicRepository<EpisodeFile>, IMediaFileRepository
|
|
|
|
{
|
2013-09-14 06:36:07 +00:00
|
|
|
public MediaFileRepository(IDatabase database, IEventAggregator eventAggregator)
|
|
|
|
: base(database, eventAggregator)
|
2013-03-01 07:03:41 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-19 05:23:04 +00:00
|
|
|
public List<EpisodeFile> GetFilesBySeries(int seriesId)
|
2013-06-02 19:29:00 +00:00
|
|
|
{
|
2013-07-19 05:23:04 +00:00
|
|
|
return Query.Where(c => c.SeriesId == seriesId).ToList();
|
2013-06-02 19:29:00 +00:00
|
|
|
}
|
|
|
|
|
2013-07-19 05:23:04 +00:00
|
|
|
public List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber)
|
2013-03-01 07:03:41 +00:00
|
|
|
{
|
2013-07-19 05:23:04 +00:00
|
|
|
return Query.Where(c => c.SeriesId == seriesId)
|
|
|
|
.AndWhere(c => c.SeasonNumber == seasonNumber)
|
|
|
|
.ToList();
|
2013-03-01 07:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|