To implement the Search
view, you will create an index that enables searching on the Name
field. Then you will create the SearchingCitiesController
class and its dedicated View. To display the search results, you will reuse the PartialCities
view created in the previous section.
Open the
World
application, right-click on theIndexes
folder, add a new class, and name itCities_SearchByName
.Modify the
Cities_SearchByName
class as follows:Create a new
Controller
class, select the Empty MVC Controller template, and name itSearchingCitiesController
.Make the
SearchingCitiesController
class inherit fromRavenBaseController
, and add ausing
statement for theRaven.Client
namespace.Modify the
SearchingCitiesController
class as follows:Right-click on the
Index()
action method of theSearchingCitiesController
class, select Add View… to create theIndex
view.In the Add View dialog, check the Create a strongly typed-view option.
Choose the
City (World.Models...