title: Many to many in asp.net mvc view and controller
body: <p>How do I handle a many to many object mapping in the view and controller in the context of <code>users</code> and <code>roles</code>?</p>
  
  <p>I used entity framework to map to pure POCOs like this:</p>
  
  <pre><code>public class Role
  {
      public int RoleId { get; set; }
      public string RoleName { get; set; }
      public List&lt;User&gt; Users { get; set; }
  }
  
  public class User
  {
      public int UserId { get; set; }
      public List&lt;Role&gt; Roles { get; set; }
  }
  </code></pre>
  
  <p>In my view, I'd like to add a User to a role using checkboxes. I list all the roles then check one to add the user to that role. How do I handle this?</p>