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?
public async Task<ActionResult> 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<thread>(sqlM).ToList();
await Task.WhenAll(resultM);
return View(new homepage { panel = resultM });
}
}
I have tried await Task.WhenAll(resultM);
but it didn't change anything.