I have been using my good friend Google to find the solution to by problem and this is as far as I have got before running out of ideas
Basically I have 3 tables
Development has a 1 to many relationship with Property (A development can have many properties)
Property has a 1 to many relationship with PropertyRent (A property can have many rents)
The problem I am having is sorting by Rental Value, here is what I have so far:
var developmentListSorted = (from d in ContextEntity.Properties
where developments.Contains(d.Development.DevelopmentId)
orderby d.PropertyRents.Select(x=>x.PropertyRentValue).OrderBy(x=>x.CompareTo(x))
select d.Development).Distinct().ToList();
Now without the OrderBy, I get a nice unsorted list. I really need to be able to sort by the PropertyRentValue.
The property ‘development’ is an array of ID’s.
Please let me know if I need to clarify this further.
Many thanks.
I’m assuming that ContextEntity.Developments gives you access to the developments
This assumes you are sorting by the minimum rent value, you could change both occurances of
MintoMaxto get max value or even useAverage