public ActionResult Edit([Bind(Include = "dependentsid,dependents_code,staffid,dependents_first_name,dependents_last_name,dependents_gender,dependents_phone_num,dependents_blood_group,dependents_passport_num,dependents_passport_expiry_date,dependents_notes,dependents_medical_condition")] dependent dependent) { if (ModelState.IsValid) { db.Entry(dependent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.staffid = new SelectList(db.staffs, "staffid", "staff_email", dependent.staffid); return(View(dependent)); }
// GET: /dependent/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } dependent dependent = db.dependents.Find(id); if (dependent == null) { return(HttpNotFound()); } return(View(dependent)); }
public ActionResult DeleteConfirmed(int id) { try { dependent dependent = db.dependents.Find(id); db.dependents.Remove(dependent); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(ex)); } }
// GET: /dependent/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } dependent dependent = db.dependents.Find(id); if (dependent == null) { return(HttpNotFound()); } ViewBag.staffid = new SelectList(db.staffs, "staffid", "staff_email", dependent.staffid); return(View(dependent)); }