title: Running tasks in parallel in ASP.NET MVC 3 Action method
body: <p>I have a Search action in an ASP.NET MVC 3 app that returns suggestions <em>containing</em> and suggestions <em>tagged</em> with the given keywords:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Search(string query, int pg = 0)
  {
      var keywords = query.Split(new[] { ' ', ',', ';' }, 
          StringSplitOptions.RemoveEmptyEntries);
  
      var containing = (from s in _readonlySession.All&lt;Suggestion&gt;()
                        from k in keywords
                        where (s.Text.ToLower().Contains(k.ToLower()))
                        orderby s.Text
                        select s).Distinct();
  
      var tagged = (from t in _readonlySession.All&lt;Tag&gt;()
                    from s in t.Suggestions
                    from k in keywords
                    where t.Text.ToLower().Contains(k.ToLower())
                    orderby s.Text
                    select s).Distinct();
  
      var model = new SearchViewModel
      {
          Query = query,
          Containing = containing.ToList(),
          Tagged = tagged.ToList()
      };
  
      return View(model);
  }
  </code></pre>
  
  <p>I think the <code>containing</code> and <code>tagged</code> queries could be perfectly run in parallel. </p>
  
  <p>What is the best way to fire these two queries at the same time, wait for the results, and return only when both queries are completed?</p>