Reputation: 21338
I need to run async Task Action in a MVC4 controller. In some articles it is stated that my controller needs to inherit AsyncController, and in some it does not.
for example in this sample:
http://www.asp.net/mvc/tutorials/mvc-4/using-asynchronous-methods-in-aspnet-mvc-4 it's not.
Upvotes: 2
Views: 278
Reputation: 605
You dont need inherit from async controller for asynschrnous actions. Below is the example.
public class HomeController : Controller
{
public async Task<ActionResult> Index()
{
DataServiceClient client = new DataServiceClient();
var cities = await client.GetCitiesAsync();
return View(cities);
}
}
Upvotes: 3