I used to implement Sync actions in web api applications, and to get data asynchronously I used AJAX in the client part to get datas from api actions.
Then I read about async controller , I need to know the lifecycle to render a page
For example :
public async Task<ActionResult> PWGasync()
{
ViewBag.SyncType = "Asynchronous";
var widgetService = new WidgetService();
var prodService = new ProductService();
var gizmoService = new GizmoService();
var widgetTask = widgetService.GetWidgetsAsync();
await Task.Run(widgetTask);
var pwgVM = new ProdGizWidgetVM( widgetTask.Result );
return View("PWG", pwgVM);
}
did the view will be rendred first and then the data will be displayed?