public ActionResult Edit(EditProbationaryContractModel editprobationarycontractplanmodel) { if (ModelState.IsValid) { db.probationaryContractPlans.Attach(editprobationarycontractplanmodel._probationaryContractPlan); db.ObjectStateManager.ChangeObjectState(editprobationarycontractplanmodel._probationaryContractPlan, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Details/" + editprobationarycontractplanmodel._probationaryContractPlan.advisementid); } return View(editprobationarycontractplanmodel); }
// // GET: /ProbationaryContract/Edit/5 /// <summary> /// Gets data required for Edit View /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(Guid id) { try { if (id != null) { probationaryContractPlan probationarycontractplan = db.probationaryContractPlans.Single(p => p.advisementid == id); issue issue = db.issues.Single(i => i.issueid == probationarycontractplan.issueid); student student = db.students.Include("program").Single(s => s.studentid == issue.studentid); EditProbationaryContractModel Model = new EditProbationaryContractModel() { _probationaryContractPlan = probationarycontractplan, _student = student }; return View(Model); } else { return RedirectToAction("Index", "Issue"); } } catch (Exception) { return RedirectToAction("Index", "Issue"); } }