title: LINQ expression to check if field contains string
body: <p>I have this code </p>
  
  <pre><code>private List&lt;Autocomplete&gt; _GetPeople(string query)
  {
      List&lt;Autocomplete&gt; people = new List&lt;Autocomplete&gt;();
      var results = (from p in db.People
               where (p.FirstName + " " + p.LastName).Contains(query)
                     orderby p.FirstName, p.LastName
                           select p).Take(10).ToList();
  }
  </code></pre>
  
  <p>I would like to know how to write something equivalent in this format</p>
  
  <pre><code> private ApplicationDbContext _dbContext;
      public PeopleController()
      {
          _dbContext = new ApplicationDbContext();
      }
  
      var result=_dbContext.people.where(p=&gt;   ...... ).contains()...
  </code></pre>
  
  <p>How can I do it? Thanks.</p>
  
  <p><strong>update</strong> I wrote some code by myself but is not working.Seems that I can not use a where with || to use double condition</p>
  
  <pre><code> var result = _dbContext.people;
              if (!string.IsNullOrEmpty(query)) result = result.Where(a =&gt; a.Name.Contains(query) || a.LastName.Contains(query));
  </code></pre>