public ActionResult Edit(EditLateEnrollementModel _EditLateEnrollementModel) { if (ModelState.IsValid) { db.requestForLateEnrolments.Attach(_EditLateEnrollementModel._requestForLateEnrolment); db.ObjectStateManager.ChangeObjectState(_EditLateEnrollementModel._requestForLateEnrolment, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Details/" + _EditLateEnrollementModel._requestForLateEnrolment.enrolementid); } return View(_EditLateEnrollementModel); }
// // GET: /LateEnrollment/Edit/5 /// <summary> /// Generates Edit View a grabs all required data /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(Guid id) { try { if (id != null) { requestForLateEnrolment requestforlateenrolment = db.requestForLateEnrolments.Single(r => r.enrolementid == id); issue issue = db.issues.Single(i => i.issueid == requestforlateenrolment.issueid); student student = db.students.Include("program").Single(s => s.studentid == issue.studentid); EditLateEnrollementModel Model = new EditLateEnrollementModel() { _requestForLateEnrolment = requestforlateenrolment, _student = student }; return View(Model); } else { return RedirectToAction("Index", "Issue"); } } catch (Exception) { return RedirectToAction("Index", "Issue"); } }