title: Automapper - Map several tables to one ViewModel
body: <p>I have a StudentClassViewModel that looks kind of like this:</p>
  
  <pre><code>    public int StudentId { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public string SchoolName { get; set; }
  
      public int ClassId { get; set; }
      public string ClassName{ get; set; }
      public string ClassSubject { get; set; }
  </code></pre>
  
  <p>The first 4 properties are from the Student Table, and last 3 are from the CLass Table.  I am mapping with AutoMapper and I am hoping to find out how to map from the ViewModel to both tables, the theory being that the VM returns the data from the View to the Controller, where I want to map from the VM to the 2 separate tables for saving.</p>
  
  <p>I am thinking it should be in the 'CreateMap' config, something like:</p>
  
  <pre><code>        Mapper.CreateMap&lt;StudentClassViewModel, Student&gt;()
              .ForMember(x =&gt; x.ClassId, y =&gt; y.Some how map to the Class table)
              .ForMember(x =&gt; x.ClassName, y =&gt; y.Some how map to the Class table)
              .ForMember(x =&gt; x.ClassSubject, y =&gt; y.Some how map to the Class table));
  </code></pre>
  
  <p>It is also possible I have completely missed the point of auto mapping, either way, let me know.</p>