title: Correctly Mapping viewmodel to entity
body: <p>I have my entity as:</p>
  
  <pre><code>public class User
  {
      public int Id { get; set; }
  
      public string Name { get; set; }
  
  public string Address { get; set; }
  }
  </code></pre>
  
  <p>I have my UserViewModel as</p>
  
  <pre><code>public class UserViewModel 
  {
      public int Id { get; set; }
  
      public string Name { get; set; }
  
      public string Address { get; set; }
  }
  </code></pre>
  
  <p>I am using these as below in my controller:</p>
  
  <pre><code>//This is called from my view via ajax
   public void Save(UserViewModel uv)
   {
      // this throws error: cannot convert from UserViewModel to Entity.User
      MyRepository.UpdateUser(uv);
   }
  </code></pre>
  
  <p>My UpdateUser in repository class is as below:</p>
  
  <pre><code>  public void UpdateUser(User u)
    {        
     var user = GetUserDetails(u.Id);
  
      user.Name = u.Name;
      user.Address = u.Address;
  
     //using entity framework to save
    _context.SaveChanges();
    }
  </code></pre>
  
  <p>How can I correctly map UserViewModel in my controller to my entity</p>