Task 3: Complete SearchController
Add a Results() action method to SearchController:
- The
Results()method should take in two parameters. Both parameters must be strings and the first one should be called “searchType” and the second one should be called “searchTerm”. - First, you need to create a local variable called “jobs” that is of type
List<Job>. - If the user enters “all” in the search box, or if they leave the box empty,
call the
FindAll()method fromJobData. Otherwise, send the search information toFindByColumnAndValue. In either case, store the results in ajobsList. - Pass
jobsinto theIndex.cshtmlview. - Pass
ListController.ColumnChoicesinto the view, as the existingIndex()action method does.
Run the tests in TestTaskThree to see how you did!