/// <inheritdoc/> public async override Task <IEnumerable <Models.Examination> > Handle(ExaminationsRetrievalQuery param) { if (param == null) { throw new ArgumentNullException(nameof(param)); } var predicate = _examinationQueryBuilder.GetPredicate(param, false); switch (param.FilterOrderBy) { case ExaminationsOrderBy.Urgency: var key = DateTime.Now.Date.UrgencyKey(); return(_store .Query() .WithPagination(param.FilterPageNumber, param.FilterPageSize) .Where(predicate) .OrderByDescending(x => x.UrgencySort[key]) .ToListAsync() .Result); case ExaminationsOrderBy.CaseCreated: return(_store.Query().WithPagination(param.FilterPageNumber, param.FilterPageSize).Where(predicate).OrderBy(x => x.CreatedAt).ToListAsync().Result); case null: return(_store.Query().WithPagination(param.FilterPageNumber, param.FilterPageSize).Where(predicate).ToListAsync().Result); default: throw new ArgumentOutOfRangeException(nameof(param.FilterOrderBy)); } }
private Expression <Func <Models.Examination, bool> > GetBaseQuery(ExaminationsRetrievalQuery param, bool isDashboardCount) { return(_baseQueryBuilder.GetPredicate(param, isDashboardCount)); }