| | | 1 | | namespace RoleRadar.Application.Reading; |
| | | 2 | | |
| | | 3 | | using System.Linq; |
| | | 4 | | using RoleRadar.Application.Reading.Models; |
| | | 5 | | |
| | | 6 | | public static class PostingOrderingExtensions |
| | | 7 | | { |
| | | 8 | | public static IOrderedQueryable<PostingReadModel> OrderByDisposition(this IQueryable<PostingReadModel> source, bool |
| | 8 | 9 | | => descending ? source.OrderByDescending(p => p.DispositionRank) : source.OrderBy(p => p.DispositionRank); |
| | | 10 | | |
| | | 11 | | public static IOrderedQueryable<PostingReadModel> ThenByDisposition(this IOrderedQueryable<PostingReadModel> source, |
| | 4 | 12 | | => descending ? source.ThenByDescending(p => p.DispositionRank) : source.ThenBy(p => p.DispositionRank); |
| | | 13 | | |
| | | 14 | | public static IOrderedQueryable<PostingReadModel> OrderByScore(this IQueryable<PostingReadModel> source, bool descen |
| | 62 | 15 | | => descending |
| | 62 | 16 | | ? source.OrderByDescending(p => p.HasScore).ThenByDescending(p => p.Score) |
| | 62 | 17 | | : source.OrderByDescending(p => p.HasScore).ThenBy(p => p.Score); |
| | | 18 | | |
| | | 19 | | public static IOrderedQueryable<PostingReadModel> ThenByScore(this IOrderedQueryable<PostingReadModel> source, bool |
| | 0 | 20 | | => descending |
| | 0 | 21 | | ? source.ThenByDescending(p => p.HasScore).ThenByDescending(p => p.Score) |
| | 0 | 22 | | : source.ThenByDescending(p => p.HasScore).ThenBy(p => p.Score); |
| | | 23 | | } |