mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
35 lines
No EOL
1 KiB
C#
35 lines
No EOL
1 KiB
C#
using System.Collections.Generic;
|
|
using NzbDrone.Core.Datastore;
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
|
|
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();
|
|
}
|
|
|
|
}
|
|
} |