IHasProductionLocations.cs 948 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace MediaBrowser.Controller.Entities
  5. {
  6. /// <summary>
  7. /// Interface IHasProductionLocations
  8. /// </summary>
  9. public interface IHasProductionLocations
  10. {
  11. /// <summary>
  12. /// Gets or sets the production locations.
  13. /// </summary>
  14. /// <value>The production locations.</value>
  15. List<string> ProductionLocations { get; set; }
  16. }
  17. public static class ProductionLocationExtensions
  18. {
  19. public static void AddProductionLocation(this IHasProductionLocations item, string name)
  20. {
  21. if (string.IsNullOrWhiteSpace(name))
  22. {
  23. throw new ArgumentNullException("name");
  24. }
  25. if (!item.ProductionLocations.Contains(name, StringComparer.OrdinalIgnoreCase))
  26. {
  27. item.ProductionLocations.Add(name);
  28. }
  29. }
  30. }
  31. }