In this recipe, we will take a look at all the workings of getting a view in MVC to sort data. The focus will not be so much on the data side of the implementation, as any data source is applicable. Instead, we will look at all of the various places that must be touched to get the plumbing working as required to sort by various fields of data. This recipe will take a look at what is needed to get the routing, view, and controller, as well as a bit of fancy LINQ over a collection of objects.
Having sortable data without data that pages seems incomplete to me. For that reason, we will start with the code from the previous recipe to get us started. This will include the
ProductRepository classes. ...