aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/IHasProductionLocations.cs
blob: e4652fa8d08606d19209e81d10734d1cbf1cb48a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Linq;

namespace MediaBrowser.Controller.Entities
{
    /// <summary>
    /// Interface IHasProductionLocations
    /// </summary>
    public interface IHasProductionLocations
    {
        /// <summary>
        /// Gets or sets the production locations.
        /// </summary>
        /// <value>The production locations.</value>
        List<string> ProductionLocations { get; set; }
    }

    public static class ProductionLocationExtensions
    {
        public static void AddProductionLocation(this IHasProductionLocations item, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }

            if (!item.ProductionLocations.Contains(name, StringComparer.OrdinalIgnoreCase))
            {
                item.ProductionLocations.Add(name);
            }
        }
    }
}