public ActionResult Edit([Bind(Include = "Id,MatricNo,FullName,Residential,Answer")] Feedback feedback) { if (ModelState.IsValid) { db.Entry(feedback).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(feedback)); }
//[HttpPost] //public ActionResult FormSubmit() //{ // var response = Request["g-recaptcha-response"]; // string secretKey = "6LdUIIcUAAAAAMBc-yYrc-gJIvVQJC5EgILCl1a-"; // var Client = new WebClient(); // var result = Client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response)); // var obj = JObject.Parse(result); // bool v = (bool)obj.SelectToken("success"); // var status = v; // ViewBag.Message = status ? "Google reCaptcha validation success" : "Google reCaptcha validation Failed!!"; // return View("Index"); //} public ActionResult SaveRecord(FeedbackViewModel model) { try { db1Entities db = new db1Entities(); Feedback fdbk = new Feedback(); Feedback feedback = new Feedback(); // feedback.MatricNo = fdbk.MatricNo; //feedback.FullName = fdbk.FullName; //feedback.Residential = fdbk.Residential; //feedback.Answer = fdbk.Answer; db.Feedbacks.Add(feedback); db.SaveChanges(feedback); int latestId = fdbk.Id; } catch (Exception e) { throw e; } return(RedirectToAction("Index")); }