title: LINQ to Entities - How to return a single string value from entity
body: <p>I am working in asp mvc 3 app.  I have a model/entity called History.  I have a linq query that returns one value.  Depending on what I do, I either get a "Object not set to an instance" error in the controller when the method is called, or I get a "cannot implicitly convert from string to type Models.History."  So I am looking for assistance in resolving, do I just need to cast it or something?</p>
  
  <p>Here is the method that gives the 'object not set' error:</p>
  
  <pre><code>public string GetPastAbuseData(int Id)
  {
  
    var query = (from h in _DB.History
                where h.ApplicantId.Equals(Id)
                select h.AbuseComment).FirstOrDefault();
  
    return query.ToString();
   }
  </code></pre>
  
  <p>Controller:
       vm.HistoryModel.AbuseComment = repo.GetPastAbuseData(Id);</p>
  
  <p>And if I change the method type from string to History I get the 'cannot convert' error:</p>
  
  <pre><code>public History GetPastAbuseData(int Id)
  {
      return (from h in _DB.History
              where h.ApplicantId.Equals(Id)
              select h.AbuseComment).SingleOrDefault();
  }
  </code></pre>
  
  <p>Thank you for your time.</p>