title: How to get a specific row from database in MVC 4
body: <p>I have a model called PageModels</p>
  
  <pre><code>public class PageModels
  {
      public int id { get; set; }
  
      public string title { get; set; }
  
      [DataType(DataType.MultilineText)]
      [AllowHtml]
      public string content { get; set; }
  
      public int parent { get; set; }
  
      [DataType(DataType.Date)]
      public DateTime created_at { get; set; }
  
      [DataType(DataType.Date)]
      public DateTime updated_at { get; set; }
  
      [DataType(DataType.Date)]
      public DateTime published_at { get; set; }
  }
  </code></pre>
  
  <p>And based on this model I have a controller called PagesController. Here I have a method:</p>
  
  <pre><code>    public ActionResult showPage(string myTitle)
      {
          var query = from a in db.Pages
                      where a.title.Contains(myTitle)
                      select a;
  
          return View(db.Pages.FirstOrDefault());
      }
  </code></pre>
  
  <p>I want to be able to get the in the return value the content property of the page that has the title given in myTitle.
  I haven't been able to find a good way of doing that.</p>
  
  <p>//EDIT</p>
  
  <p>That error that I kept getting was my fault ... between trying to fix my problem and implementing your solution I changed the methods return type to PageModels and that's why it kept throwing me that error. Now it works but the view doesn't show anything. I'll try to fix that myself thanks for all the help.</p>