Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Is it possible to call async action from non async action in mvc 5. Example given below.

public ActionResult Index()
{

i want to call below async method from here. is it possible?

}

public async Task<actionresult> Index(MyModel myModel)
{
//Have some service call and return the list.

}


Appreciate the response ASAP.
Thanks,

What I have tried:

i try to add with Task.Run, it gives compile error.
Posted
Updated 6-Jun-16 20:14pm
v2
Comments
George Swan 7-Jun-16 17:40pm    
I'm not sure exactly what you are trying to achieve but I recently wrote a piece on the use of the async and await keywords, which may be helpful.
http://www.codeproject.com/Articles/1097427/Asynchronous-Programming-Getting-to-grips-with-Asy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900