diff options
Diffstat (limited to 'MediaBrowser.Model/Entities/ProviderIdsExtensions.cs')
| -rw-r--r-- | MediaBrowser.Model/Entities/ProviderIdsExtensions.cs | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs index c643f1ecd..4aff6e3a4 100644 --- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs +++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs @@ -10,28 +10,6 @@ namespace MediaBrowser.Model.Entities public static class ProviderIdsExtensions { /// <summary> - /// Determines whether [has provider identifier] [the specified instance]. - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <returns><c>true</c> if [has provider identifier] [the specified instance]; otherwise, <c>false</c>.</returns> - public static bool HasProviderId(this IHasProviderIds instance, MetadataProvider provider) - { - return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); - } - - /// <summary> - /// Gets a provider id. - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <returns>System.String.</returns> - public static string? GetProviderId(this IHasProviderIds instance, MetadataProvider provider) - { - return instance.GetProviderId(provider.ToString()); - } - - /// <summary> /// Gets a provider id. /// </summary> /// <param name="instance">The instance.</param> @@ -47,7 +25,7 @@ namespace MediaBrowser.Model.Entities if (instance.ProviderIds == null) { - id = string.Empty; + id = null; return false; } @@ -79,6 +57,17 @@ namespace MediaBrowser.Model.Entities } /// <summary> + /// Gets a provider id. + /// </summary> + /// <param name="instance">The instance.</param> + /// <param name="provider">The provider.</param> + /// <returns>System.String.</returns> + public static string? GetProviderId(this IHasProviderIds instance, MetadataProvider provider) + { + return instance.GetProviderId(provider.ToString()); + } + + /// <summary> /// Sets a provider id. /// </summary> /// <param name="instance">The instance.</param> @@ -94,13 +83,7 @@ namespace MediaBrowser.Model.Entities // If it's null remove the key from the dictionary if (string.IsNullOrEmpty(value)) { - if (instance.ProviderIds != null) - { - if (instance.ProviderIds.ContainsKey(name)) - { - instance.ProviderIds.Remove(name); - } - } + instance.ProviderIds?.Remove(name); } else { |
