|
-
Oct 14th, 2012, 06:46 AM
#1
Thread Starter
Hyperactive Member
Need help with LINQ Query - Order by bool, then parent -> children
Hi,
I'm showing a list of services which have the following members (removed non-relevant ones):
Code:
public string Name { get; set; }
public bool Compulsory { get; set; }
public IList<Service> ChildServices { get; set; }
public Service ParentService { get; set; }
I want order showing the Compulsory one's first (though not so important), then showing each that have sub-services, then it's sub-services...make any sense?
Like
Service 55 (Compulsory)
Service 2
Service 2A
Service 2B
Service 3
Service 3B
..etc
At present I'm just ordering by compulsory and then name
Code:
model = _repository.GetAll().OrderByDescending(x => x.Compulsory).ThenBy(x=>x.Name);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|