Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
Let's say you have the following block controller:
public class MyBlockController : BlockController<MyBlock>
{
public override ActionResult Index(MyBlock currentBlock)
{
...
return PartialView(model);
}
}
Create new base controller:
public abstract class BaseController<TContentData> : ActionControllerBase, IRenderTemplate<TContentData>, IRenderTemplate where TContentData : IContentData
{
}
Your block controller should look like this:
public class MyBlockController : BaseController<MyBlock>
{
public async Task<ActionResult> Index(MyBlock currentBlock)
{
...
await DoAwaitableOperation();
...
return PartialView(model);
}
}
Hope this helps!
Hi Muhammad, your first try should work. This is how I have implemented async task ->
public async Task<ActionResult> Index(ArticlePage currentPage)
{
}
I inherit PageController. It works. You have the identical code, right?
Thanks guys
I have managed to solved it without hassle. I used Andreas' approach which seems most easy.
Hi
I have this a method: public override ActionResult Index(someobject)
Which I want to turn into: public async Task Index(someobject)
However above does not work.
Anyone got an idea to how to have async actionresult methods in episerver?