@ -1,5 +1,6 @@
using System.Collections.Generic ;
using System.Linq ;
using NzbDrone.Core.ImportLists ;
using NzbDrone.Core.Messaging.Events ;
using NzbDrone.Core.Notifications ;
using NzbDrone.Core.Profiles.Delay ;
@ -25,6 +26,7 @@ namespace NzbDrone.Core.Tags
private readonly ITagRepository _repo ;
private readonly IEventAggregator _eventAggregator ;
private readonly IDelayProfileService _delayProfileService ;
private readonly IImportListFactory _importListFactory ;
private readonly INotificationFactory _notificationFactory ;
private readonly IRestrictionService _restrictionService ;
private readonly IArtistService _artistService ;
@ -32,6 +34,7 @@ namespace NzbDrone.Core.Tags
public TagService ( ITagRepository repo ,
IEventAggregator eventAggregator ,
IDelayProfileService delayProfileService ,
ImportListFactory importListFactory ,
INotificationFactory notificationFactory ,
IRestrictionService restrictionService ,
IArtistService artistService )
@ -39,6 +42,7 @@ namespace NzbDrone.Core.Tags
_repo = repo ;
_eventAggregator = eventAggregator ;
_delayProfileService = delayProfileService ;
_importListFactory = importListFactory ;
_notificationFactory = notificationFactory ;
_restrictionService = restrictionService ;
_artistService = artistService ;
@ -65,6 +69,7 @@ namespace NzbDrone.Core.Tags
{
var tag = GetTag ( tagId ) ;
var delayProfiles = _delayProfileService . AllForTag ( tagId ) ;
var importLists = _importListFactory . AllForTag ( tagId ) ;
var notifications = _notificationFactory . AllForTag ( tagId ) ;
var restrictions = _restrictionService . AllForTag ( tagId ) ;
var artist = _artistService . AllForTag ( tagId ) ;
@ -74,6 +79,7 @@ namespace NzbDrone.Core.Tags
Id = tagId ,
Label = tag . Label ,
DelayProfileIds = delayProfiles . Select ( c = > c . Id ) . ToList ( ) ,
ImportListIds = importLists . Select ( c = > c . Id ) . ToList ( ) ,
NotificationIds = notifications . Select ( c = > c . Id ) . ToList ( ) ,
RestrictionIds = restrictions . Select ( c = > c . Id ) . ToList ( ) ,
ArtistIds = artist . Select ( c = > c . Id ) . ToList ( )
@ -84,6 +90,7 @@ namespace NzbDrone.Core.Tags
{
var tags = All ( ) ;
var delayProfiles = _delayProfileService . All ( ) ;
var importLists = _importListFactory . All ( ) ;
var notifications = _notificationFactory . All ( ) ;
var restrictions = _restrictionService . All ( ) ;
var artists = _artistService . GetAllArtists ( ) ;
@ -97,6 +104,7 @@ namespace NzbDrone.Core.Tags
Id = tag . Id ,
Label = tag . Label ,
DelayProfileIds = delayProfiles . Where ( c = > c . Tags . Contains ( tag . Id ) ) . Select ( c = > c . Id ) . ToList ( ) ,
ImportListIds = importLists . Where ( c = > c . Tags . Contains ( tag . Id ) ) . Select ( c = > c . Id ) . ToList ( ) ,
NotificationIds = notifications . Where ( c = > c . Tags . Contains ( tag . Id ) ) . Select ( c = > c . Id ) . ToList ( ) ,
RestrictionIds = restrictions . Where ( c = > c . Tags . Contains ( tag . Id ) ) . Select ( c = > c . Id ) . ToList ( ) ,
ArtistIds = artists . Where ( c = > c . Tags . Contains ( tag . Id ) ) . Select ( c = > c . Id ) . ToList ( )