using Hotline.Application.Exam.Core.Utilities; using Hotline.Exams.ExamManages; using Hotline.Share.Requests.Exam; using JiebaNet.Segmenter.Common; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace Hotline.Application.Exam.QueryExtensions.ExamManages { public static class OfflineExamQueryExtensions { public static Expression> GetExpression(this OfflineExamAnalysisPagedRequest offlineExamAnalysisPagedRequest) { Expression> expression = m => m.Id != null; expression = ExpressionableUtility.CreateExpression() .AndIF(offlineExamAnalysisPagedRequest.StartTime.IsNotNull(), x => x.StartTime >= offlineExamAnalysisPagedRequest.StartTime) .AndIF(offlineExamAnalysisPagedRequest.EndTime.IsNotNull(), x => x.StartTime <= offlineExamAnalysisPagedRequest.EndTime) .AndIF(offlineExamAnalysisPagedRequest.Keyword.IsNotEmpty(), x => x.ExamName.Contains(offlineExamAnalysisPagedRequest.Keyword)) .AndIF(offlineExamAnalysisPagedRequest.MinScore.IsNotNull(), x => x.Score > offlineExamAnalysisPagedRequest.MinScore) .AndIF(offlineExamAnalysisPagedRequest.MaxScore.IsNotNull(), x => x.Score < offlineExamAnalysisPagedRequest.MaxScore) .ToExpression(); return expression; } } }