title: How do I use Dapper in an asynchronous controller?
body: <p>This is my first time using async/await with the Dapper ORM. I keep getting the message that my controller lacks the await method. How can I correctly insert the await method in my code?</p>
  
  <pre><code>public async Task&lt;ActionResult&gt; index(int? page)
  {
  
      if (page == null)
      {
          page = 1;
          ViewBag.page = page;
      }
      else
      {
  
          ViewBag.page = page;
      }
      string Connectionstring = ConfigurationManager.ConnectionStrings["mycontext"].ConnectionString;
      using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Connectionstring))
      {
  
          sqlConnection.Open();
          var sqlM = @"SELECT * from threads order by activities desc";
          var resultM = sqlConnection.Query&lt;thread&gt;(sqlM).ToList();
          await Task.WhenAll(resultM);
          return View(new homepage { panel = resultM });
      }
  
  
  }
  </code></pre>
  
  <p>I have tried  <code>await Task.WhenAll(resultM);</code> but it didn't change anything.</p>