public ActionResult Details(DetailsProgramWithdrawalModel _model) { if (ModelState.IsValid) { try { Guid? id = _model._NewNote.formid; _model._NewNote.noteid = Guid.NewGuid(); _model._NewNote.employeeid = User.Identity.Name; _model._NewNote.dates = DateTime.Now; _model._NewNote.controller = "ProgramWithdrawal"; db.notes.AddObject(_model._NewNote); db.SaveChanges(); return RedirectToAction("Details", new { id = id }); } catch (Exception) { return RedirectToAction("Index", "Issue"); } } return View(_model); }
// // GET: /ProgramWithdrawal/Details/5 /// <summary> /// Grabs a single entry in the database to populate the View /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Details(Guid id) { try { if (id != null) { applicationForTermOrCompleteProgramWithdrawal applicationfortermorcompleteprogramwithdrawal = db.applicationForTermOrCompleteProgramWithdrawals.Single(a => a.withdrawid == id); issue issue = db.issues.Single(i => i.issueid == applicationfortermorcompleteprogramwithdrawal.issueid); student student = db.students.Include("program").Single(s => s.studentid == issue.studentid); DetailsProgramWithdrawalModel Model = new DetailsProgramWithdrawalModel() { _applicationForTermOrCompleteProgramWithdrawal = applicationfortermorcompleteprogramwithdrawal, _student = student, _note = db.notes.Include("employee").Where(note => note.formid == id).OrderByDescending(f => f.dates), _employee = db.employees.Single(e => e.employeeid == User.Identity.Name), _date = DateTime.Now }; return View(Model); } else { return RedirectToAction("Index", "Issue"); } } catch (Exception) { return RedirectToAction("Index", "Issue"); } }