protected void Page_Load(object sender, EventArgs e) { var widgetService = new WidgetService(); WidgetGridView.DataSource = widgetService.GetWidgets(); WidgetGridView.DataBind(); }
public ActionResult Widgets() { ViewBag.SyncOrAsync = "Synchronous"; var widgetService = new WidgetService(); return(View("Widgets", widgetService.GetWidgets())); }
protected void Page_Load(object sender, EventArgs e) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); var widgetService = new WidgetService(); var prodService = new ProductService(); var gizmoService = new GizmoService(); var pwgVM = new ProdGizWidgetVM( widgetService.GetWidgets(), prodService.GetProducts(), gizmoService.GetGizmos() ); WidgetGridView.DataSource = pwgVM.widgetList; WidgetGridView.DataBind(); ProductGridView.DataSource = pwgVM.prodList; ProductGridView.DataBind(); GizmoGridView.DataSource = pwgVM.gizmoList; GizmoGridView.DataBind(); stopWatch.Stop(); ElapsedTimeLabel.Text = String.Format("Elapsed time: {0}", stopWatch.Elapsed.Milliseconds / 1000.0); }
protected void Page_Load(object sender, EventArgs e) { var widgetService = new WidgetService(); var widgetList = widgetService.GetWidgets(); // ToDo, display Widgets }
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)); }
public void ServiceShouldGetAllWidgets() { var widgets = new List <Dm.Widget> { new Dm.Widget { Id = (int)System.DateTime.Now.Ticks } }; var widgetRepository = new Mock <IRepository <Dm.Widget> >(); widgetRepository.Setup(x => x.FindAll(y => y.Active, null)).Returns(widgets); var service = new WidgetService(widgetRepository.Object); var results = service.GetWidgets(); widgetRepository.Verify(x => x.FindAll(y => y.Active, null), Times.Once); Assert.IsNotNull(results); Assert.AreEqual(widgets.Count, results.Count); Assert.AreEqual(widgets[0].Id, results[0].Id); }
public IEnumerable <WidgetResource> Get() { return(_widgetsService.GetWidgets()); }