title: mvc in asp.net doesnt satisfy programmers
body: <p>I am learning MVC4 in Visual Studio and I have many questions about it. My first statement about MVC is that MVC's Model doesnt do what I expected. I expect Model to select and return the data rows according to the needs. </p>
  
  <p>But I read many tutorial and they suggest me to let Model return ALL the data from the table and then eliminate the ones I dont need in the controller, then send it to the View.</p>
  
  <p>here is the code from tutorials</p>
  
  <p>MODEL</p>
  
  <pre><code>public class ApartmentContext : DbContext
  {
      public ApartmentContext() : base("name=ApartmentContext") { }
      public DbSet&lt;Apartment&gt; Apartments {    get; set;   }
  }
  </code></pre>
  
  <p>CONTROLLER</p>
  
  <pre><code> public ActionResult Index()
      {
          ApartmentContext db = new ApartmentContext();
          var apartments = db.Apartments.Where(a =&gt; a.no_of_rooms == 5);
          return View(apartments);
      }
  </code></pre>
  
  <p>Is this the correct way to apply "where clause" to a select statement? I dont want to select all the data and then eliminate the unwanted rows. This seems weird to me but everybody suggest this, at least the tutorials I read suggest this.</p>