title: Best way to project ViewModel back into Model
body: <p>Consider having a ViewModel:</p>
  <pre><code>public class ViewModel
  {
      public int id { get; set; }
      public int a { get; set; }
      public int b { get; set; }
  }
  </code></pre>
  <p>and an original Model like this:</p>
  <pre><code>public class Model
  {
      public int id { get; set; }
      public int a { get; set; }
      public int b { get; set; }
      public int c { get; set; }
      public virtual Object d { get; set; }
  }
  </code></pre>
  <p>Each time I get the view model I have to put all <code>ViewModel</code> properties one by one into <code>Model</code>. Something like:</p>
  <pre><code>var model = Db.Models.Find(viewModel.Id);
  model.a = viewModel.a;
  model.b = viewModel.b;
  Db.SaveChanges();
  </code></pre>
  <p>Which always cause lots of problems. I even sometimes forget to mention some properties and then disaster happens!
  I was looking for something like:</p>
  <pre><code>Mapper.Map(model, viewModel);
  </code></pre>
  <p>BTW: I use AutoMapper only to convert Model to ViewModel but vice-versa I always face errors.</p>