I have a local collection that I am trying to sort with Linq but the returned in memory collection still remains sorted by the numeric ID column FailureID. Any idea why these OrderBy clauses are not taking effect?
Object
Public Class OpenBuildFaultsViewModel
Public Property FailureID As Int64
Public Property ModelName As String
Public Property ZoneName As String
Public Property Fault As String
Public Property FaultCode As String
Public Property FaultCodeDetail As String
Public Property FaultArea As String
Public Property MajorAssembly As String
Public Property SubAssembly As String
Public Property ComponentAssembly As String
Public Property BusinessTest As String
Public Property AuditScore As String
Public Property Comment As String
Public Property ShortagePart As String
Public Property CreatedBy As String
Public Property FixedByID As Int32
Public Property FixedByComment As String
Public Property FixedByFaultRectificationID As Int32
End Class
Order By
Function Index() As ActionResult
Dim data As IEnumerable(Of OpenBuildFaultsViewModel) = Session("Failures")
Dim model = From fails In data.Where(Function(w) w.FixedByID.Equals(0)).
OrderBy(Function(o) o.MajorAssembly).
OrderBy(Function(o) o.SubAssembly).
OrderBy(Function(o) o.ComponentAssembly).
OrderBy(Function(o) o.BusinessTest).
OrderBy(Function(o) o.FailureID)
Return View(model)
End Function