コード例 #1
0
        public List <TagDetails> Details()
        {
            var tags          = All();
            var delayProfiles = _delayProfileService.All();
            var importLists   = _importListFactory.All();
            var notifications = _notificationFactory.All();
            var restrictions  = _restrictionService.All();
            var movies        = _movieService.AllMovieTags();
            var indexers      = _indexerService.All();

            var details = new List <TagDetails>();

            foreach (var tag in tags)
            {
                details.Add(new TagDetails
                {
                    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(),
                    MovieIds        = movies.Where(c => c.Value.Contains(tag.Id)).Select(c => c.Key).ToList(),
                    IndexerIds      = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
                });
            }

            return(details);
        }
コード例 #2
0
        public List <TagDetails> Details()
        {
            var tags          = All();
            var delayProfiles = _delayProfileService.All();
            var importLists   = _importListFactory.All();
            var notifications = _notificationFactory.All();
            var restrictions  = _releaseProfileService.All();
            var authors       = _authorService.GetAllAuthors();
            var rootFolders   = _rootFolderService.All();

            var details = new List <TagDetails>();

            foreach (var tag in tags)
            {
                details.Add(new TagDetails
                {
                    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(),
                    AuthorIds       = authors.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
                    RootFolderIds   = rootFolders.Where(c => c.DefaultTags.Contains(tag.Id)).Select(c => c.Id).ToList()
                });
            }

            return(details);
        }
コード例 #3
0
ファイル: TagService.cs プロジェクト: Macharr/Macharr
        public List <TagDetails> Details()
        {
            var tags          = All();
            var delayProfiles = _delayProfileService.All();
            var notifications = _notificationFactory.All();
            var restrictions  = _releaseProfileService.All();
            var series        = _seriesService.GetAllSeries();

            var details = new List <TagDetails>();

            foreach (var tag in tags)
            {
                details.Add(new TagDetails
                {
                    Id              = tag.Id,
                    Label           = tag.Label,
                    DelayProfileIds = delayProfiles.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(),
                    SeriesIds       = series.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
                }
                            );
            }

            return(details);
        }
コード例 #4
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            if (context.PropertyValue == null)
            {
                return(true);
            }

            dynamic instance   = context.ParentContext.InstanceToValidate;
            var     instanceId = (int)instance.Id;

            var collection = context.PropertyValue as HashSet <int>;

            if (collection == null || collection.Empty())
            {
                return(true);
            }

            return(_delayProfileService.All().None(d => d.Id != instanceId && d.Tags.Intersect(collection).Any()));
        }
コード例 #5
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            if (context.PropertyValue == null)
            {
                return(true);
            }

            var delayProfile = new DelayProfile();

            delayProfile.InjectFrom(context.ParentContext.InstanceToValidate);

            var collection = context.PropertyValue as HashSet <int>;

            if (collection == null || collection.Empty())
            {
                return(true);
            }

            return(_delayProfileService.All().None(d => d.Id != delayProfile.Id && d.Tags.Intersect(collection).Any()));
        }
コード例 #6
0
 public List <DelayProfileResource> GetAll()
 {
     return(_delayProfileService.All().ToResource());
 }
コード例 #7
0
 private List <DelayProfileResource> GetAll()
 {
     return(_delayProfileService.All().InjectTo <List <DelayProfileResource> >());
 }