public ActionResult UpdateTestimonial(TestimonialDetails TestimonialDetails, HttpPostedFileBase TestimonialPic) { GetApplicationCookie(); string url = "TestimonialData/UpdateTestimonial/" + TestimonialDetails.DepartmentDto.DepartmentId + "/" + TestimonialDetails.TestimonialDto.testimonial_Id; HttpContent content = new StringContent(jss.Serialize(TestimonialDetails.TestimonialDto)); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PostAsync(url, content).Result; if (response.IsSuccessStatusCode) { if (TestimonialPic != null) { //Send over image data for movie url = "TestimonialData/UpdateTestimonialPic/" + TestimonialDetails.TestimonialDto.testimonial_Id; MultipartFormDataContent requestcontent = new MultipartFormDataContent(); HttpContent imagecontent = new StreamContent(TestimonialPic.InputStream); requestcontent.Add(imagecontent, "TestimonialPic", TestimonialPic.FileName); response = client.PostAsync(url, requestcontent).Result; } return(RedirectToAction("DetailsofDepartment", "Department", new { Id = TestimonialDetails.DepartmentDto.DepartmentId })); } else { return(RedirectToAction("Error")); } }
public ActionResult UpdateTestimonial(TestimonialDetails TestimonialDetails) { string url = "TestimonialData/UpdateTestimonial/" + TestimonialDetails.DepartmentDto.DepartmentId + "/" + TestimonialDetails.TestimonialDto.testimonial_Id; HttpContent content = new StringContent(jss.Serialize(TestimonialDetails.TestimonialDto)); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PostAsync(url, content).Result; if (response.IsSuccessStatusCode) { return(RedirectToAction("DetailsofDepartment", "Department", new { Id = TestimonialDetails.DepartmentDto.DepartmentId })); } else { return(RedirectToAction("Error")); } }
public ActionResult DeleteConfirm(int DepartmentId, int TestimonialId) { TestimonialDetails Testimonial_Details = new TestimonialDetails(); string url = "TestimonialData/FindTestimonial/" + TestimonialId; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { TestimonialDto Testimonial = response.Content.ReadAsAsync <TestimonialDto>().Result; Testimonial_Details.TestimonialDto = Testimonial; url = "DepartmentData/FindDepartment/" + DepartmentId; response = client.GetAsync(url).Result; DepartmentsDto Department = response.Content.ReadAsAsync <DepartmentsDto>().Result; Testimonial_Details.DepartmentDto = Department; return(View(Testimonial_Details)); } else { return(RedirectToAction("Error")); } }