Hello.
I have a model (Generic Model) that has an IList of another model (Unit). Within in that model there is an IList of a different model (Section).
When I pull some information I want to sort the Unit list by UnitNumber and then within each Unit sort the Section list by SectionNumber. I can get it to work in a round about way, but I was wondering if there was an easier way to do it.
How I do it now is create a new Section Object, manipulate it then set it to the Unit.
This is how I would like to do it (or something similar):
viewModel.Units = viewModel.Units.OrderBy(x => x.UnitNumber).ToList(); foreach(var u in viewModel.Units) { u.Sections.OrderBy(s => s.SectionNumber).ToList(); }
The above works for the Units, but not the Sections.
Any thoughts?