make Sort private and use Enum parse

This commit is contained in:
lostb1t 2024-08-19 11:47:34 +02:00
parent 0b7dc7ff64
commit 4344b951a6

View File

@ -112,13 +112,11 @@ namespace MediaBrowser.Controller.Entities.Movies
return true;
}
public IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user)
private IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user)
{
var sortBy = ItemSortBy.PremiereDate;
if (!string.IsNullOrEmpty(DisplayOrder))
if (!Enum.TryParse<ItemSortBy>(DisplayOrder, out var sortBy))
{
sortBy = Enum.Parse<ItemSortBy>(DisplayOrder);
sortBy = ItemSortBy.PremiereDate;
}
if (sortBy == ItemSortBy.Default)