title: MVC2 How To Edit Multiple Linked Customer Addresses
body: <p>A Customer has a billing and delivery address, so given the following database schema</p>
  
  <ul>
  <li>Customer(CustomerId)</li>
  <li>Address(AddressId)</li>
  <li>CustomerAddresses(CustomerId,AddressId)</li>
  </ul>
  
  <p>And the following Enitity Framework class</p>
  
  <pre><code>public class Customer
  {
      public IEnumerable&lt;Address&gt; Addresses { get; set; }
  }
  </code></pre>
  
  <p>I output my input boxes in my view like so</p>
  
  <pre><code>&lt;% foreach (var address in Model.Addresses) { %&gt; 
  
      &lt;%: Html.TextBoxFor(model =&gt; address.Address1) %&gt;
  
  &lt;% } %&gt;
  </code></pre>
  
  <p>When I post the form values after entering DeliveryAddress1 and BillingAddress1 and then iterate over the FormCollection keys I get the following value</p>
  
  <blockquote>
    <p>Customer.address.Address1 =
    "DeliveryAddress1,BillingAddress1"</p>
  </blockquote>
  
  <p>The question is how do I distinguish between the two records?</p>