Using async (asynchronous) and await in ASP.Net MVC

on Sep 24, 2020 02:22 AM


I have one action method

i need to apply async and await keywords but here getting error

could you please help me how to apply 

async and await keywords on below action method 

public async Task<ActionResult> GetCompanyName()
    var comp = await(db.companies.Select(model => new { model.Id, model.Name }).ToList());
    return Json(comp, JsonRequestBehavior.AllowGet);


Download FREE API for Word, Excel and PDF in ASP.Net: Download