public ActionResult Edit(int id, FormCollection collection) { try { Patient patient = new Patient { //all the form values coming as a string... id = Convert.ToInt32(collection["id"]), name = collection["name"], gender = collection["gender"], doctor_name = collection["doctor_name"], room_type = collection["room_type"], age = Convert.ToInt32(collection["age"]), blood = collection["blood"], address = collection["address"], phone_no = collection["phone_no"] }; patientPortal.update(patient); return(RedirectToAction("Index")); } catch { return(View()); } }