public async Task<ActionResult> PWGasync() { ViewBag.SyncType = "Asynchronous"; var widgetService = new WidgetService(); var prodService = new ProductService(); var gizmoService = new GizmoService(); var widgetTask = widgetService.GetWidgetsAsync(); var prodTask = prodService.GetProductsAsync(); var gizmoTask = gizmoService.GetGizmosAsync(); await Task.WhenAll(widgetTask, prodTask, gizmoTask); var pwgVM = new ProdGizWidgetVM( widgetTask.Result, prodTask.Result, gizmoTask.Result ); return View("PWG", pwgVM); }
public async Task<ActionResult> ProductsAsync() { ViewBag.SyncOrAsync = "Asynchronous"; var productsService = new ProductService(); return View("Products", await productsService.GetProductsAsync()); }