From 1ead63b0d1a532cf828a4ed7c5310eef9c255740 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 8 Mar 2014 13:17:05 -0500 Subject: add column sorting to reports --- .../Sorting/StudioComparer.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 MediaBrowser.Server.Implementations/Sorting/StudioComparer.cs (limited to 'MediaBrowser.Server.Implementations/Sorting/StudioComparer.cs') diff --git a/MediaBrowser.Server.Implementations/Sorting/StudioComparer.cs b/MediaBrowser.Server.Implementations/Sorting/StudioComparer.cs new file mode 100644 index 000000000..83ab4dfc2 --- /dev/null +++ b/MediaBrowser.Server.Implementations/Sorting/StudioComparer.cs @@ -0,0 +1,30 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Sorting; +using MediaBrowser.Model.Querying; +using System.Linq; + +namespace MediaBrowser.Server.Implementations.Sorting +{ + public class StudioComparer : IBaseItemComparer + { + /// + /// Compares the specified x. + /// + /// The x. + /// The y. + /// System.Int32. + public int Compare(BaseItem x, BaseItem y) + { + return AlphanumComparator.CompareValues(x.Studios.FirstOrDefault() ?? string.Empty, y.Studios.FirstOrDefault() ?? string.Empty); + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get { return ItemSortBy.Studio; } + } + } +} -- cgit v1.2.3