2013-05-19 23:17:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NzbDrone.Core.Datastore;
|
2013-09-14 06:36:07 +00:00
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
2013-09-11 06:33:47 +00:00
|
|
|
|
|
2013-05-19 23:17:32 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Notifications
|
|
|
|
|
{
|
|
|
|
|
public interface INotificationRepository : IBasicRepository<NotificationDefinition>
|
|
|
|
|
{
|
|
|
|
|
NotificationDefinition Get(string name);
|
|
|
|
|
NotificationDefinition Find(string name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class NotificationRepository : BasicRepository<NotificationDefinition>, INotificationRepository
|
|
|
|
|
{
|
2013-09-14 06:36:07 +00:00
|
|
|
|
public NotificationRepository(IDatabase database, IEventAggregator eventAggregator)
|
|
|
|
|
: base(database, eventAggregator)
|
2013-05-19 23:17:32 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NotificationDefinition Get(string name)
|
|
|
|
|
{
|
|
|
|
|
return Query.Single(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NotificationDefinition Find(string name)
|
|
|
|
|
{
|
|
|
|
|
return Query.SingleOrDefault(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|