...

/

Querying a Database and Using Display Templates

Querying a Database and Using Display Templates

Learn to implement price-based filtering in ASP.NET Core MVC by creating an action method, querying the Northwind database, and displaying the results in a view.

Let’s create a new action method with a query string parameter passed to it and use that to query the Northwind database for products that cost more than a specified price.

Implementing price-based filtering

We defined a view model containing properties for every value that needed to be rendered. In this example, there will be two values: a list of products and the price the visitor entered. To avoid defining a class or record for the view model, we will pass the list of products as the model and store the ...