March 2016
Intermediate to advanced
550 pages
10h 57m
English
Now that you've seen the basics of how models, views, and controllers work together to provide a web application, let's look at some common scenarios, such as passing parameters and annotating models.
Back in the HomeController class, add the following action method. It uses something called the default model binder
to automatically match the id passed in the route to the parameter named id in the method.
Model binders are very powerful, and the default one does a lot for you. For advanced scenarios, you can create your own by implementing the IModelBinder interface, but that is beyond the scope of this book.
Inside the method, we check to see whether the id is null, and if so, ...
Read now
Unlock full access