Looks like you really need a list of lists, where each nested list is ordered with the criteria you mentioned.
Up vote 0 down vote favorite share g+ share fb share tw.
I have this two entities: public class Course { public int Id { get; set; } public string Name { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public virtual ICollection Classes { get; set; } } public class Class { public int Id { get; set; } public string Name { get; set; } public DateTime StartTime { get; set; } public DateTime EndTime { get; set; } public Course Course { get; set; } } Now I need to list each Class grouping by Course and ordered by (descending) Course. StartDate then by Class.StartTime. I can get to group by Course and order by Course.
StartDate: var myList = context. Classes . GroupBy(c => c.
Course) . OrderByDescending(g => g.Key. StartDate).ToList() But can't manage to also order each Class by it's StartTime.
I tried this: var myList = context. Classes . OrderBy(c => c.
StartTime) . GroupBy(c => c. Course) .
OrderByDescending(g => g.Key. StartDate).ToList() And even this: var myList = context. Classes .
GroupBy(c => c. Course) . OrderByDescending(g => g.Key.
StartDate) . ThenBy(g => g. Select(c => c.
StartTime)).ToList() But the Classes are never ordered by it's StartTime. Any help is apreciated (I'm using code-first 4.3 btw). C# linq linq-to-entities ef-code-first link asked 3 mins agoHenrique Miranda645 82% accept rate.
Looks like you really need a list of lists, where each nested list is ordered with the criteria you mentioned: var myList = context. Classes . GroupBy(c => c.
Course) . OrderByDescending(g => g.Key. StartDate) .
Select(g => g. OrderBy(c => c. StartTime)) .ToList().
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.