Пример #1
0
        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);
        }
Пример #2
0
 public async Task<ActionResult> ProductsAsync()
 {
     ViewBag.SyncOrAsync = "Asynchronous";
     var productsService = new ProductService();
     return View("Products", await productsService.GetProductsAsync());
 }