Reputation: 24582
I have this code:
return Ok(new
{
Answer = (string) null,
Text = question.Text,
Answers = question.Answers.Select((a, i) => new
{
AnswerId = a.AnswerId,
AnswerUId = i + 1,
Correct = (bool?) null,
Response = (bool?) null,
Text = a.Text
})
});
How can I order the Answers returned by AnswerId ?
Upvotes: 1
Views: 40
Reputation: 70327
Just add
.OrderBy( z => z.AnswerId)
immediately after your Select statement.
Upvotes: 3