public ActionResult StudentProposal(StudentProposal student) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(Shared.ServerConfig.GetBaseUrl() + "fyp1post/addproposalstudent"); //HTTP POST var postTask = client.PostAsJsonAsync <StudentProposal>("addproposalstudent", student); postTask.Wait(); var result = postTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("StudentHome")); } } return(View()); }
public ActionResult StudentProposal(StudentProposal student) { using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44380/api/fyp1post/addproposalstudent"); //HTTP POST var postTask = client.PostAsJsonAsync <StudentProposal>("addproposalstudent", student); postTask.Wait(); var result = postTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("StudentHome")); } } return(View()); }