Example #1
0
        public ActionResult EnviarTarefaATurma(int idTarefa)
        {
            using (var client = new WebClient()) {
                try {
                    var obj    = client.DownloadString(APIUrl.Turmas(Convert.ToInt32(User.Identity.Name)));
                    var turmas = JsonConvert.DeserializeObject(obj, typeof(List <Interface.Turma>));

                    var viewModel = Mapper.Map <TarefaViewModel>(turmas);
                    viewModel.Id = idTarefa;

                    return(View(viewModel));
                } catch (WebException ex) {
                    ModelState.AddModelError(string.Empty, ex.Message);
                    return(View());
                }
            }
        }