// GET: Task/Details/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            DevSchool.Models.Task TaskInfo = new DevSchool.Models.Task();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseUrl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("api/Task" + "/" + id.ToString());

                if (Res.IsSuccessStatusCode)
                {
                    var TaskResponse = Res.Content.ReadAsStringAsync().Result;
                    TaskInfo = JsonConvert.DeserializeObject <DevSchool.Models.Task>(TaskResponse);
                }
            }

            return(View(TaskInfo));
        }
        public async Task <ActionResult> Create([Bind(Include = "ID,Title,Description,Status,CreationDate")] DevSchool.Models.Task task)
        {
            if (ModelState.IsValid)
            {
                using (var client = new HttpClient())
                {
                    var serializedTask = JsonConvert.SerializeObject(task);
                    var content        = new StringContent(serializedTask, Encoding.UTF8, "application/json");
                    var result         = await client.PostAsync(baseUrl + "/api/Task", content);
                }

                return(RedirectToAction("Index"));
            }

            return(View(task));
        }
        public async Task <ActionResult> Edit([Bind(Include = "ID,Title,Description,Status,CreationDate")] DevSchool.Models.Task task)
        {
            if (ModelState.IsValid)
            {
                using (var client = new HttpClient())
                {
                    HttpResponseMessage responseMessage =
                        await client.PutAsJsonAsync(baseUrl + "/api/Task/" + task.Id, task);

                    if (responseMessage.IsSuccessStatusCode)
                    {
                        //MessageBox.Show("Produto atualizado");
                    }
                    else
                    {
                        //MessageBox.Show("Falha ao atualizar o produto : " + responseMessage.StatusCode);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }