aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/KeywordExtensions.cs
blob: 5c9afdf3d57740e6ade4c40d3d06ede52f1b3cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Linq;

namespace MediaBrowser.Controller.Entities
{
    public static class KeywordExtensions
    {
        public static void AddKeyword(this BaseItem item, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }

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