I have noticed, the web API's do not get ordered in any specific order (or at least by API name) in the help page. I would like to order by name category if possible. Unable to use OrderBy on ToLookup very well. Here is the code it comes with by default:
@{
 // Group APIs by controller
  ILookup<string, ApiDescription> apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor.ControllerName);
 }
<div>                    
   <section>
    @foreach (var group in apiGroups)
    {
        @Html.DisplayFor(m => group, "ApiGroup")
    }
   </section>
</div>
                The above answer is almost right it just needed the controllername off on the end.
ILookup<HttpControllerDescriptor, ApiDescription> apiGroups = Model.OrderBy(d => d.ActionDescriptor.ControllerDescriptor.ControllerName).ToLookup(api => api.ActionDescriptor.ControllerDescriptor);
I tested it and all works now.
Order in the loop:
<div>                    
   <section>
    @foreach (var group in apiGroups.OrderBy(x => x.Key))
    {
        @Html.DisplayFor(m => group, "ApiGroup")
    }
   </section>
</div>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With