public ActionResult Edit([Bind(Include = "id,first_name,last_name,title,email,gender,address,phone")] Doctor doctor) { if (ModelState.IsValid) { db.Entry(doctor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(doctor)); }
public ActionResult Edit([Bind(Include = "id,doc_id,date,time")] Appointment appointment) { appointment.userID = User.Identity.GetUserId(); ModelState.Clear(); TryValidateModel(appointment); if (ModelState.IsValid) { db.Entry(appointment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.doc_id = new SelectList(db.Doctors, "id", "first_name", appointment.doc_id); return(View(appointment)); }