I need to sort the results of an entity framework query by the index of elements in another list.
I tried the suggestion found elsewhere, like
.Then
this should do the trick:
private IEnumerable PopulateQuery(string selectedCampus) { var list = new List {"Fall","Mid","Spring"}; return _db.MiaLog1A.Where(m => m.Campus == selectedCampus) .AsEnumerable() .OrderBy(m => m.StudentName) .ThenBy(m=> list.IndexOf(m.Term)); }