title: Using DBContext to Select Fields
body: <p>I've got a couple questions regarding DBContext and achieveing my desired Results. 
  I can retrieve data like this</p>
  
  <pre><code>---Model
     public class InvoiceModel
  {
      [Key]
      public int? Invoice_Number { get; set; }
      public decimal Amt_Total { get; set; }
      public decimal Amt_Due { get; set; }
      public decimal Amt_Paid { get; set; }
  
      public List&lt;InvoiceModel&gt; GetInvoice()
      {
          using (VuittonEntities db = new VuittonEntities())
          {
              return (from inv in db.Invoice
                      select new InvoiceModel
                      {
                          Invoice_Number = inv.Invoice_,
                          Amt_Total = inv.AmountTotal,
                          Amt_Due = inv.AmountDue,
                          Amt_Paid = inv.AmountPaid
                      }).ToList();
          }
      }
  
  --- Controller
  public ViewResult Index()
      {
        var data = new InvoiceModel().GetInvoice();
        return View(data);
      }
  </code></pre>
  
  <p>This is pretty much standard LinQ and it returns my Invoice table with the 4 fields I selected. But now I want to achieve this using DB Context. So I added this new Class to my controller and called it in the view like this.</p>
  
  <pre><code> Controller 
  public class VuittonEntities : DbContext
      {
          public DbSet&lt;InvoiceModel&gt; Invoice { get; set; }
      }
   View
     public ViewResult Index()
      {
            VuittonEntities db = new VuittonEntities();       
            return View(db.Invoice.ToList());
      }
  </code></pre>
  
  <p>It returns the Entire table and I have to comment out my List'InvoiceModel' class</p>
  
  <p>Assumptions:
  VuittonEntities is my Connection String Name,
  Invoice is the table
  Vuitton is my .edmx class --
  I heard that this can be achieved without having to use a Select Statement. It appears I am not linking my model class to a LinQ entity but when I add my context class, it throws errors on my inv."FieldName" columns in my List{InvoiceModel} Class.</p>
  
  <p>TLDR Version: 
  How Can I return selected fields from DbContext Class instead of entire table 
  Why does adding a DBContext class raise errors on my List(ModelClass) fields</p>