示例#1
0
        public IEnumerable <AlbumResource> FilterAlbums(IEnumerable <AlbumResource> albums, int metadataProfileId)
        {
            var metadataProfile = _metadataProfileService.Exists(metadataProfileId) ? _metadataProfileService.Get(metadataProfileId) : _metadataProfileService.All().First();
            var primaryTypes    = new HashSet <string>(metadataProfile.PrimaryAlbumTypes.Where(s => s.Allowed).Select(s => s.PrimaryAlbumType.Name));
            var secondaryTypes  = new HashSet <string>(metadataProfile.SecondaryAlbumTypes.Where(s => s.Allowed).Select(s => s.SecondaryAlbumType.Name));
            var releaseStatuses = new HashSet <string>(metadataProfile.ReleaseStatuses.Where(s => s.Allowed).Select(s => s.ReleaseStatus.Name));


            return(albums.Where(album => primaryTypes.Contains(album.Type) &&
                                (!album.SecondaryTypes.Any() && secondaryTypes.Contains("Studio") ||
                                 album.SecondaryTypes.Any(x => secondaryTypes.Contains(x))) &&
                                album.ReleaseStatuses.Any(x => releaseStatuses.Contains(x))));
        }
 private MetadataProfileResource GetById(int id)
 {
     return(_profileService.Get(id).ToResource());
 }
示例#3
0
 protected override MetadataProfileResource GetResourceById(int id)
 {
     return(_profileService.Get(id).ToResource());
 }