mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-29 02:57:15 +02:00
32 lines
994 B
C#
32 lines
994 B
C#
using System;
|
|
using System.Linq;
|
|
using NzbDrone.Core.Datastore;
|
|
using NzbDrone.Core.Messaging;
|
|
|
|
|
|
namespace NzbDrone.Core.Notifications
|
|
{
|
|
public interface INotificationRepository : IBasicRepository<NotificationDefinition>
|
|
{
|
|
NotificationDefinition Get(string name);
|
|
NotificationDefinition Find(string name);
|
|
}
|
|
|
|
public class NotificationRepository : BasicRepository<NotificationDefinition>, INotificationRepository
|
|
{
|
|
public NotificationRepository(IDatabase database, IMessageAggregator messageAggregator)
|
|
: base(database, messageAggregator)
|
|
{
|
|
}
|
|
|
|
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));
|
|
}
|
|
}
|
|
} |