mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-26 23:25:06 +01:00
428acd7558
* Update sample project to dotnetcore3.1 * Use Sqlite in sample project to run it everywhere * Fix: Filter with escaped comma * Fix: Filter "null" does not work with Contains or StartsWith * Code cleanup: Adjust namespaces, adjust usings
16 lines
495 B
C#
16 lines
495 B
C#
using System.Linq;
|
|
using Sieve.Sample.Entities;
|
|
using Sieve.Services;
|
|
|
|
namespace Sieve.Sample.Services
|
|
{
|
|
public class SieveCustomSortMethods : ISieveCustomSortMethods
|
|
{
|
|
public IQueryable<Post> Popularity(IQueryable<Post> source, bool useThenBy) => useThenBy
|
|
? ((IOrderedQueryable<Post>)source).ThenBy(p => p.LikeCount)
|
|
: source.OrderBy(p => p.LikeCount)
|
|
.ThenBy(p => p.CommentCount)
|
|
.ThenBy(p => p.DateCreated);
|
|
}
|
|
}
|