Sorting peoples

This commit is contained in:
Zoe Roux 2020-04-04 15:49:05 +02:00
parent 8df8cd4b20
commit e1286eda28

View File

@ -188,7 +188,7 @@ namespace Kyoo.Controllers
public IEnumerable<PeopleLink> GetPeople(long showID) public IEnumerable<PeopleLink> GetPeople(long showID)
{ {
return from link in _database.PeopleLinks where link.ShowID == showID select link; return from link in _database.PeopleLinks where link.ShowID == showID orderby link.People.ImgPrimary == null, link.Name select link;
} }
public People GetPeopleBySlug(string slug) public People GetPeopleBySlug(string slug)
@ -263,6 +263,8 @@ namespace Kyoo.Controllers
public IEnumerable<People> SearchPeople(string searchQuery) public IEnumerable<People> SearchPeople(string searchQuery)
{ {
return (from people in _database.Peoples where EF.Functions.Like(people.Name, $"%{searchQuery}%") select people) return (from people in _database.Peoples where EF.Functions.Like(people.Name, $"%{searchQuery}%") select people)
.OrderBy(x => x.ImgPrimary == null)
.ThenBy(x => x.Name)
.Take(20); .Take(20);
} }