Updating controller actions to support filtering

The first thing we need to do is update our products controller action to support some optional filter parameters. Open up Features/Products/Controller.cs, locate the Find action, and change its method signature to the following:

[HttpGet]public async Task<IActionResult> Find(string brands, int? minPrice, int? maxPrice, int? minScreen, int? maxScreen, string capacity, string colours, string os, string features){  //method body omitted for brevity…}

Here, we are specifying that the client needs to send string values for the brand, capacity, colors, and features filters. Multiple selections can be concatenated with some kind of delimiter value, which we will see in a moment. In addition to these, ...

Get ASP.NET Core 2 and Vue.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.