Esempio n. 1
0
        public ActionResult NovaTarefa()
        {
            using (var client = new WebClient()) {
                try {
                    var obj      = client.DownloadString(APIUrl.QuestoesPorProfessor(Convert.ToInt32(User.Identity.Name)));
                    var questoes = JsonConvert.DeserializeObject(obj, typeof(List <Interface.Questao>));

                    var viewModel = Mapper.Map <TarefaViewModel>(questoes);
                    return(View(viewModel));
                } catch (WebException ex) {
                    ModelState.AddModelError(string.Empty, ex.Message);
                    return(View());
                }
            }
        }