Beispiel #1
0
        public ActionResult EnviarParaCorrecao(int idResolucao)
        {
            var resolucao = new Resolucao {
                Id      = idResolucao,
                IdAluno = Convert.ToInt32(User.Identity.Name)
            };

            using (var client = new WebClient()) {
                client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
                try {
                    client.UploadString(APIUrl.EnviarTarefaParaCorrecao(), "PUT",
                                        JsonConvert.SerializeObject(resolucao));

                    return(RedirectToAction("Index"));
                } catch (WebException ex) {
                    ModelState.AddModelError(string.Empty, ex.Message);
                    return(RedirectToAction("Index"));
                }
            }
        }