title: mvc.net how to edit nested viewmodel classes
body: <p>I have the following nested viewmodel class...</p>
  
  <pre><code>public class CustomerModel
  {
    public string name;
    public Address mailingAddress;
    public Address billingAddress;
  }
  
  public class Address
  {
    public string line1;
    public string city;
    public string country;
  }
  </code></pre>
  
  <p>I was hoping that there is some automated way to create an edit page, but everything that I've tried and read indicates that the framework and code-generates only handle top level properties in your viewmodel.  The 'name' property is the only one generated in the view and in the action, it is only the 'name' property that is populated with the addresses being left as null.</p>
  
  <pre><code>[HttpPost]
  public ActionResult Edit(CustomerModel model)
  </code></pre>
  
  <p>however, if i manually add input boxes for the address (through partial views) and switch over to the FormCollection signature for the action, i get the appropriate address values entered on the screen.</p>
  
  <p>is there any easy solution for this other than creating my own function to convert from FormCollection to CustomerModel?</p>