Sonarr/NzbDrone.Core/Indexers/IndexerRepository.cs

33 lines
942 B
C#
Raw Normal View History

2013-04-10 23:44:48 +00:00
using System;
using System.Linq;
2013-05-05 21:24:33 +00:00
using NzbDrone.Common.Messaging;
2013-02-21 07:07:34 +00:00
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Indexers
{
2013-04-07 07:30:37 +00:00
public interface IIndexerRepository : IBasicRepository<IndexerDefinition>
2013-02-21 07:07:34 +00:00
{
2013-04-07 07:30:37 +00:00
IndexerDefinition Get(string name);
2013-04-10 23:44:48 +00:00
IndexerDefinition Find(string name);
2013-02-21 07:07:34 +00:00
}
2013-04-07 07:30:37 +00:00
public class IndexerRepository : BasicRepository<IndexerDefinition>, IIndexerRepository
2013-02-21 07:07:34 +00:00
{
2013-05-05 21:24:33 +00:00
public IndexerRepository(IDatabase database, IMessageAggregator messageAggregator)
: base(database, messageAggregator)
2013-02-21 07:07:34 +00:00
{
}
2013-04-07 07:30:37 +00:00
public IndexerDefinition Get(string name)
2013-02-21 07:07:34 +00:00
{
2013-04-10 23:44:48 +00:00
return Query.Single(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
2013-02-21 07:07:34 +00:00
}
2013-04-10 23:44:48 +00:00
public IndexerDefinition Find(string name)
{
return Query.SingleOrDefault(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
}
2013-02-21 07:07:34 +00:00
}
}