2013-03-24 04:16:00 +00:00
|
|
|
using System.Data;
|
2013-03-02 18:25:39 +00:00
|
|
|
using System.Linq;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.ReferenceData
|
|
|
|
{
|
|
|
|
public interface ISceneMappingRepository : IBasicRepository<SceneMapping>
|
|
|
|
{
|
|
|
|
SceneMapping FindByTvdbId(int tvdbId);
|
|
|
|
SceneMapping FindByCleanTitle(string cleanTitle);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public class SceneMappingRepository : BasicRepository<SceneMapping>, ISceneMappingRepository
|
|
|
|
{
|
2013-03-24 04:16:00 +00:00
|
|
|
public SceneMappingRepository(IDbConnection database)
|
|
|
|
: base(database)
|
2013-03-02 18:25:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public SceneMapping FindByTvdbId(int tvdbId)
|
|
|
|
{
|
2013-03-24 04:16:00 +00:00
|
|
|
return SingleOrDefault(c => c.TvdbId == tvdbId);
|
2013-03-02 18:25:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public SceneMapping FindByCleanTitle(string cleanTitle)
|
|
|
|
{
|
2013-03-24 04:16:00 +00:00
|
|
|
return SingleOrDefault(c => c.CleanTitle == cleanTitle);
|
2013-03-02 18:25:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|