2013-02-19 09:56:02 +03:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Tv
|
|
|
|
{
|
|
|
|
public interface ISeriesRepository : IBasicRepository<Series>
|
|
|
|
{
|
|
|
|
bool SeriesPathExists(string path);
|
|
|
|
List<Series> Search(string title);
|
2013-02-20 05:05:15 +03:00
|
|
|
Series GetByTitle(string cleanTitle);
|
2013-02-19 09:56:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public class SeriesRepository : BasicRepository<Series>, ISeriesRepository
|
|
|
|
{
|
|
|
|
public SeriesRepository(IObjectDatabase objectDatabase)
|
|
|
|
: base(objectDatabase)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool SeriesPathExists(string path)
|
|
|
|
{
|
|
|
|
return Queryable.Any(s => DiskProvider.PathEquals(s.Path, path));
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Series> Search(string title)
|
|
|
|
{
|
|
|
|
return Queryable.Where(s => s.Title.Contains(title)).ToList();
|
|
|
|
}
|
|
|
|
|
2013-02-20 05:05:15 +03:00
|
|
|
public Series GetByTitle(string cleanTitle)
|
2013-02-19 09:56:02 +03:00
|
|
|
{
|
|
|
|
return Queryable.SingleOrDefault(s => s.CleanTitle.Equals(cleanTitle));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|