I need to order a list by status == “Rejected” and date ascending and then by status == “Accepted” and date descending.
I am trying the following but I’m not sure how to go about this:
items
.OrderBy(x => x.status == "Rejected")
.ThenBy(x => x.DateSubmitted)
.ThenBy(x => x.status == "Accepted")
.ThenByDescending(x => x.DateSubmitted)
You’re describing the task a bit awkward, which (I think) leads you to a slightly wrong implementation.
I say:
The main difference is that now, status other than “Rejected” or “Accepted” are not shown.
However, I think it is what you intended. If you want the full set, consider using
PS. This is also assuming Linq-To-Objects. I’m not very well-versed with Linq-to-EF or Linq-to-SQL