title: MVC map viewmodel to domain model (without automapper) for edit action
body: <p>I have nothing against automapper, but would like to understand the manual method first.</p>
  
  <p>My table that will be updated is area_list</p>
  
  <p>My viewmodel:</p>
  
  <pre><code> public class AreaView
  {
      public int area_id { get; set; }
      public string area_name { get; set; }
      public string facility_name { get; set; }
      public int facility_id { get; set; }
  }
  </code></pre>
  
  <p>The Edit view has two fields, area_id (hidden) and area_name</p>
  
  <p>My Edit controller (post), which is where my question is:</p>
  
  <pre><code> [HttpPost]
      public ActionResult Edit(AreaView e_area)
      {
          if (ModelState.IsValid)
          {
              areaDB.Entry(e_area).State = EntityState.Modified;
              areaDB.SaveChanges();
              return RedirectToAction("List", new { id = e_area.facility_id });
          }
          return View(e_area);
      }
  </code></pre>
  
  <p>Could someone provide an example of how to manually map the viewmodel to the area_list (model, created by entity framework)?  Am I binding the AreaView viewmodel correctly?</p>
  
  <p>This would be in the controller for now, though if it should reside somewhere else, all ears.</p>
  
  <p>Thank you.</p>