title: Passing data from ViewModel to DataModel
body: <p>I am trying to learn C# and MVC better and am working on a project to help me do so. As part of this I am trying to create a user sign up and log in aspect to my web site. I am using Entity Framework and am trying to follow all the best practices that I know or have come across and I think I'm getting a little mixed up with a few things. </p>
  
  <p>I have created a Presentation Layer, a DataLayer and a BusinessLayer. This has basically left me with an issue now as I cant do what seems obvious as it would be a circular dependency and as this is a bad thing anyway I wondered if I am even going about this the right way.</p>
  
  <p>In my Presentation Layer I have put my ViewModel and Controller.</p>
  
  <p>In my DataLayer is all my EF classes and models.</p>
  
  <p>I also have a BusinessLayer but have nothing in here yet (not 100% what should go in here yet)</p>
  
  <p>My Presentation Layer is obviously dependent on my DataLayer but what is the best way to pass the data from my ViewModel in the PresentationLayer back to the data model in the DataLayer to update the database? In the View the user will basically enter log in information and this will then need to be sent to my Entity in the DataLayer which then uses the Entities EF to access the database. I cant add my Presentation Layer as a dependency to my DataLayer as this creates a circular dependency.</p>
  
  <p>I have read about automapper but not really sure if this is correct or where this logic should go, should it be in the Model or a separate class and in which Layer? I also tried doing something with Unity and Dependency Injection but think I am now getting mixed up about what is actually needed and applying what I am reading to what I am actually trying to do. I can get this working by putting everything in the one project but obviously I am trying to do this right from a design point of view.</p>