Exemplo n.º 1
0
        public ActionResult PWG()
        {
            ViewBag.SyncType = "Synchronous";
            var widgetService = new WidgetService();
            var prodService = new ProductService();
            var gizmoService = new GizmoService();

            var pwgVM = new ProdGizWidgetVM(
                widgetService.GetWidgets(),
                prodService.GetProducts(),
                gizmoService.GetGizmos()
               );

            return View("PWG", pwgVM);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public ActionResult Widgets()
        {
            ViewBag.SyncOrAsync = "Synchronous";
            var widgetService = new WidgetService();

            return View("Widgets", widgetService.GetWidgets());
        }
Exemplo n.º 4
0
 public async Task<ActionResult> WidgetsAsync()
 {
     ViewBag.SyncOrAsync = "Asynchronous";
     var widgetService = new WidgetService();
     return View("Widgets", await widgetService.GetWidgetsAsync());
 }