2013-04-11 02:44:48 +03:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2013-02-21 10:07:34 +03:00
|
|
|
using NzbDrone.Core.Datastore;
|
2013-09-14 09:36:07 +03:00
|
|
|
using NzbDrone.Core.Messaging.Events;
|
2013-09-11 09:33:47 +03:00
|
|
|
|
2013-02-21 10:07:34 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Indexers
|
|
|
|
{
|
2013-04-07 10:30:37 +03:00
|
|
|
public interface IIndexerRepository : IBasicRepository<IndexerDefinition>
|
2013-02-21 10:07:34 +03:00
|
|
|
{
|
2013-04-07 10:30:37 +03:00
|
|
|
IndexerDefinition Get(string name);
|
2013-04-11 02:44:48 +03:00
|
|
|
IndexerDefinition Find(string name);
|
2013-02-21 10:07:34 +03:00
|
|
|
}
|
|
|
|
|
2013-04-07 10:30:37 +03:00
|
|
|
public class IndexerRepository : BasicRepository<IndexerDefinition>, IIndexerRepository
|
2013-02-21 10:07:34 +03:00
|
|
|
{
|
2013-09-14 09:36:07 +03:00
|
|
|
public IndexerRepository(IDatabase database, IEventAggregator eventAggregator)
|
|
|
|
: base(database, eventAggregator)
|
2013-02-21 10:07:34 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-07 10:30:37 +03:00
|
|
|
public IndexerDefinition Get(string name)
|
2013-02-21 10:07:34 +03:00
|
|
|
{
|
2013-04-11 02:44:48 +03:00
|
|
|
return Query.Single(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
|
2013-02-21 10:07:34 +03:00
|
|
|
}
|
2013-04-11 02:44:48 +03:00
|
|
|
|
|
|
|
public IndexerDefinition Find(string name)
|
|
|
|
{
|
|
|
|
return Query.SingleOrDefault(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
|
|
|
|
}
|
|
|
|
|
2013-02-21 10:07:34 +03:00
|
|
|
}
|
|
|
|
}
|