public async Task <ActionResult> GizmosAsync() { ViewBag.SyncOrAsync = "Asynchronous"; var gizmoService = new GizmoService(); return(View("Gizmos", await gizmoService.GetGizmosAsync())); }
private async Task GetPWGsrvAsync() { 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 ); WidgetGridView.DataSource = pwgVM.widgetList; WidgetGridView.DataBind(); ProductGridView.DataSource = pwgVM.prodList; ProductGridView.DataBind(); GizmoGridView.DataSource = pwgVM.gizmoList; GizmoGridView.DataBind(); }
public async Task <ActionResult> PWGtimeOut(CancellationToken cancellationToken) { ViewBag.SyncType = "Asynchronous with CancellationToken"; var widgetService = new WidgetService(); var prodService = new ProductService(); var gizmoService = new GizmoService(); var widgetTask = widgetService.GetWidgetsAsync(cancellationToken); var prodTask = prodService.GetProductsAsync(cancellationToken); var gizmoTask = gizmoService.GetGizmosAsync(cancellationToken); await Task.WhenAll(widgetTask, prodTask, gizmoTask); var pwgVM = new ProdGizWidgetVM( widgetTask.Result, prodTask.Result, gizmoTask.Result ); ViewBag.numGizmos = pwgVM.gizmoList.Count(); ViewBag.numWidgets = pwgVM.widgetList.Count(); ViewBag.numProducts = pwgVM.prodList.Count(); return(View("PWG", pwgVM)); }
private async Task GetGizmosSvcCancelAsync(CancellationToken cancellationToken) { var gizmoService = new GizmoService(); var gizmoList = await gizmoService.GetGizmosAsync(cancellationToken); GizmosGridView.DataSource = gizmoList; GizmosGridView.DataBind(); }
private async Task GetGizmosSvcAsync() { var gizmoService = new GizmoService(); var gizmoList = await gizmoService.GetGizmosAsync(); GizmosGridView.DataSource = gizmoList; GizmosGridView.DataBind(); }
public async Task <ActionResult> GizmosCancelAsync( CancellationToken cancellationToken) { ViewBag.SyncOrAsync = "Asynchronous"; var gizmoService = new GizmoService(); return(View("Gizmos", await gizmoService.GetGizmosAsync(cancellationToken))); }
public async Task <ActionResult> GizmosAsync() { System.Diagnostics.Debug.WriteLine("Entering GizmosAsync. Context: " + SynchronizationContext.Current.GetHashCode()); ViewBag.SyncOrAsync = "Asynchronous"; var gizmoService = new GizmoService(); var gizmos = await gizmoService.GetGizmosAsync(); ViewBag.numGizmos = gizmos.Count(); System.Diagnostics.Debug.WriteLine("Leaving GizmosAsync"); return(View("Gizmos", gizmos)); }
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)); }