So basically you're saying that a parent is listed after its children rather than before, correct? If so then try this:That is, again, untested.Code:model = _repository.GetAll() .OrderByDescending(x => x.ParentService == null ? x.Compulsory : x.ParentService.Compulsory) .ThenBy(x => x.ParentService == null ? x.Name : x.ParentName) .ThenByDescending(x => x.ParentService == null) .ThenBy(x => x.Name);




Reply With Quote