我想编写一个 EF 查询,它根据条件按升序或降序进行排序。以下是我的伪代码:
var result= q.OrderByDescending(x => x.StatusId == 3)
then if( x.StatusId == 3)
then order by x.ReserveDate
else
then order by descending x.LastUpdateDate
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?