public Task<ViewResult> Index() { return Task<ViewResult>.Factory.StartNew(() => { using (var client = new NewsServiceClient()) { var timer = new Stopwatch(); timer.Start(); var worldNews = client.GetWorldNews(); var sportNews = client.GetSportNews(); var funNews = client.GetFunNews(); var result = worldNews .Union(sportNews) .Union(funNews) .Convert(); timer.Stop(); var model = new ViewModel { News = result, Elapsed = timer.Elapsed }; return View(model); } }); }
public Task <ViewResult> Index() { return(Task <ViewResult> .Factory.StartNew(() => { using (var client = new NewsServiceClient()) { var timer = new Stopwatch(); timer.Start(); var worldNews = client.GetWorldNews(); var sportNews = client.GetSportNews(); var funNews = client.GetFunNews(); var result = worldNews .Union(sportNews) .Union(funNews) .Convert(); timer.Stop(); var model = new ViewModel { News = result, Elapsed = timer.Elapsed }; return View(model); } })); }
// // GET: /Home/ public ActionResult Index() { using (var client = new NewsServiceClient()) { var timer = new Stopwatch(); timer.Start(); var worldNews = client.GetWorldNews(); var sportNews = client.GetSportNews(); var funNews = client.GetFunNews(); var result = worldNews .Union(sportNews) .Union(funNews) .Convert(); timer.Stop(); var model = new ViewModel { News = result, Elapsed = timer.Elapsed }; return(View(model)); } }