Testing the Application
You are ready to test your MVC Web Application:
- In Solution Explorer, right-click the CarRentWebSite project and select Set as StartUp Project.
- Press F5 to run your project.
- Navigate to the Category tab. The CategoryController.Index method will be the first method executed. All categories will be retrieved from the database and sent to the Index view.
-
Clicking the Create New link will execute the Create method and will display the Create view. Create a new Category. When you click the Create button, the "postback" Create method will be executed. When you go back to the Index view, inspect the other three commands Details, Edit and Delete. Now, switch to the Car view and click the Create New link.
The biggest disadvantage of the current solution is that when you create a new car, you have to enter a CategoryId. It will be good if you display a drop-down with all available categories from the database. To see, how to implement this task, check out the Working with Related Data topic.