asp.net - LINQ query select entity and its collection query -
I have an institution called parent, in which there is a list of children in it. Now I order a guardian and all his children I want to choose by display order.
Organizations: - Class Parents {IIT ID; & Lt; Child & gt; children; } Class child {string name; Date time debit; Int DisplayOrder; } Previously I was using a parent from the database as a unit from the Linux
context.Parents.Find (id); It was doing everything fine but now my requirement has changed, I have to choose the order of my children from their display order. How can i do it Any help is appreciated.
Update parent category: -
class guardian {public int id; Public Virtual List & lt; Child & gt; children; }
With the information you provided, I think that you can write your Kids are using to display them somewhere so that you can just use parent.children.OrderBy (x => x.DisplayOrder) .Oolist () just parent.children I think you had it before. Update 1 Also, as far as I remember find children The value to try something like this: var original = reference. mother-father. Included (x = & gt; x.children) .FirstOrDefault (x => x.id = id); mother-father. Children = Parents children. OrderB (x = & gt; x.DisplayOrder). Ollist ();
Comments
Post a Comment