I have an Asynchronous controller implementation as follows,
public Task<ActionResult> UpdateUser(ProfileModel model)
{
return Task.Factory.StartNew(showMethod).ContinueWith(
t =>
{
return RedirectToAction("ViewUser","UserProfile");
});
}
However I am unable to redirect to the action as I am keep on getting the error,
Cannot implicitly convert type, System.Threading.Taska.Task<Sytem.Web.Mvc.RedirectToRouteResult>
to System.Threading.Taska.Task<Sytem.Web.Mvc.ActionResult>
However I really want to redirect to the mentioned Action, how can I do that.
For people who come here looking for an answer, the newer versions of .NET make things simpler. Use the keyword async
in the definition of the method and you can clear up the body.
public async Task<ActionResult> UpdateUser(ProfileModel model)
{
return RedirectToAction("ViewUser","UserProfile");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With