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 ajobs
List. - Pass
jobs
into theIndex.cshtml
view. - Pass
ListController.ColumnChoices
into the view, as the existingIndex()
action method does.
Run the tests in TestTaskThree
to see how you did!