title: What is the different between Model/Business Layer/Data Access and Repositories in the MVC architecture?
body: <p>I like to start my question by stating that I am new to .NET framework and ASP.NET altogether. However, I am trying to learn ASP.NET 5 MVC 6. I have read many tutorial to get me up to speed. The main tutorial that I have learned a lot from was "<a href="http://www.codeproject.com/Articles/866143/Learn-MVC-step-by-step-in-days-Day" rel="noreferrer">Learn MVC in 7 Days</a>"</p>
  
  <p>I think I get the <code>MVC</code> architecture over all, but there is some terminology/layers that are confusing me i.e. Model, Business Logic layer, Data Access layer and View Model.</p>
  
  <p>Here is my overall understanding of the MVC architecture "Please correct me if wrong"</p>
  
  <ul>
  <li>(M) Model: is an object that represent a database table. Each table in the database is a model. Each column with in each table is an attribute in the model's object. For example, if I have a table called "users" with the following columns <code>id</code>,<code>firstname</code>,<code>lastname</code> and <code>username</code> then the model will be called <code>user</code> and "<code>id</code>,<code>firstname</code>,<code>lastname</code> and <code>username</code>" are attributes.</li>
  <li>(V) View: is the way to present the data to the end user by placing data into HTML page.</li>
  <li>(C) Controller: is a layer that will be called by the route engine. The controller class holds some logic on what data/views should the user see. For example, <code>UsersController</code> class has a method called <code>Index()</code> which request some data from the <code>user</code> model and then returns a view called <code>ShowAllUsers</code>.</li>
  </ul>
  
  <p>However, Model seems to have another 3 layers underneath it like so</p>
  
  <ul>
  <li>View Model: which seems to be a way to transform the raw data coming from the model into a presentable "view ready" format. For example, if we want to present the user's Full Name to the end user but we do not have fullname as an attribute in the model. Then we this layer will create a new object which is the same at the model object with one additional virtual attribute called fullname. Therefore, we now can display obj.fullname in the view.</li>
  <li>Business Logic Layer</li>
  <li>Data Access layer</li>
  </ul>
  
  <p>Additionally, if I want to have a <a href="http://www.codeguru.com/csharp/.net/net_asp/mvc/using-the-repository-pattern-with-asp.net-mvc-and-entity-framework.htm" rel="noreferrer">repository</a> for my controller, where would this fit here? I do understand this may not be necessary for a small application, but I am just trying to understand and learn the correct way then I can decide whether this is needed in my app or not.</p>
  
  <p>My question here is what is the business logic layer and what is data access layer? and where would the <a href="http://www.codeguru.com/csharp/.net/net_asp/mvc/using-the-repository-pattern-with-asp.net-mvc-and-entity-framework.htm" rel="noreferrer">repository</a> fit here?</p>
  
  <p>I will appreciate an explanation with an example.</p>