public ActionResult Index() { using (var client = new WebClient()) { try { var obj = client.DownloadString(APIUrl.Tarefas(Convert.ToInt32(User.Identity.Name))); var tarefas = JsonConvert.DeserializeObject(obj, typeof(List <Interface.Tarefa>)); var viewModel = Mapper.Map <List <TarefaViewModel> >(tarefas); return(View(viewModel)); } catch (WebException ex) { ModelState.AddModelError(string.Empty, ex.Message); return(View()); } } }