Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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());
        }