I currently have a controller that's returning a list of results. Some results get multiple hits, for example:
result x,
result x,
result x,
result y,
result z
I'm then trying to sort these results by the number of hits they have with this code here:
(orgs.Organisations is a list of Organisations i.e. results)
orgs.Organisations = orgs.Organisations
.GroupBy(f => f.Name)
.SelectMany(c => c.OrderByDescending(p => p.Name.Count()))
.ToList();
This is the closest I think I have gotten but its still not returning them in the correct order. Any guidance would be greatly appreciated.