Chapter 6. The binding model: retrieving and validating user input
This chapter covers
- Using request values to create a binding model
- Customizing the model binding process
- Validating user input using DataAnnotations attributes
In chapter 5, I showed you how to define a route with parameters—perhaps for the day in a calendar or the unique ID for a product page. But say a user requests a given product page—what then? Similarly, what if the request includes data from a form, to change the name of the product, for example? How do you handle that request and access the values the user provided?
In the first half of this chapter, we’ll look at using a binding model to retrieve those parameters from the request so that you can use them in your ...