ModelBinder
public class CustomerController: Controller {
public ActionResult EnterCustomerDetails(){
render View("EnterCustomerDetails");
}
/*
if in the EnterCustomerDetails view , we have a HTML form with action="SubmitCustomerDetails" (below Action) and the names of the input fields in the form match exactly with the Customer model, then in the below method, MVC would automatically match the passed `customer` parameter's properties to the input field's data matching with the property name. Thus data in a field name 'name' would be assigned to customer.name property
*/
public ActionResult SubmitCustomerDetails(Customer customer) {
return View("ShowCustomerDetails", customer);
}
}Last updated