added missing GetResourceById methods.

This commit is contained in:
kay.one
2013-08-26 00:14:46 -07:00
parent 0fa4934358
commit 317586c102
3 changed files with 27 additions and 3 deletions

View File

@@ -18,11 +18,17 @@ namespace NzbDrone.Api.Notifications
_notificationService = notificationService;
GetResourceAll = GetAll;
GetResourceById = GetNotification;
CreateResource = Create;
UpdateResource = Update;
DeleteResource = DeleteNotification;
}
private NotificationResource GetNotification(int id)
{
return _notificationService.Get(id).InjectTo<NotificationResource>();
}
private List<NotificationResource> GetAll()
{
var notifications = _notificationService.All();
@@ -44,13 +50,13 @@ namespace NzbDrone.Api.Notifications
private int Create(NotificationResource notificationResource)
{
var notification = GetNotification(notificationResource);
var notification = ConvertToNotification(notificationResource);
return _notificationService.Create(notification).Id;
}
private void Update(NotificationResource notificationResource)
{
var notification = GetNotification(notificationResource);
var notification = ConvertToNotification(notificationResource);
notification.Id = notificationResource.Id;
_notificationService.Update(notification);
}
@@ -60,7 +66,7 @@ namespace NzbDrone.Api.Notifications
_notificationService.Delete(id);
}
private Notification GetNotification(NotificationResource notificationResource)
private Notification ConvertToNotification(NotificationResource notificationResource)
{
var notification = _notificationService.Schema()
.SingleOrDefault(i =>