public async Task <IActionResult> Index() { using (var client = new HttpClient()) { try { client.BaseAddress = new Uri("http://localhost:5000"); string url = $"api/task"; ViewData["tasks"] = await _taskFactory.MapToList(client, url); } catch (Exception e) { Console.WriteLine(e); throw; } } return(View()); }