public ActionResult DeleteConfirmed(int id) { StudentEnrolment studentEnrolment = db.Enrolment.Find(id); db.Enrolment.Remove(studentEnrolment); db.SaveChanges(); return(RedirectToAction("Index")); }
public static StudentDto ToStudentDto(this StudentEnrolment studentEnrolment) { return(new StudentDto() { Id = studentEnrolment.StudentId, Name = studentEnrolment.StudentName }); }
public ActionResult Edit([Bind(Include = "Id,ModuleId,StudentId")] StudentEnrolment studentEnrolment) { if (ModelState.IsValid) { db.Entry(studentEnrolment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ModuleId = new SelectList(db.Modules, "Id", "ModuleName", studentEnrolment.ModuleId); ViewBag.StudentId = new SelectList(db.StudentUserAccounts, "Id", "FullName", studentEnrolment.StudentId); return(View(studentEnrolment)); }
// GET: StudentEnrolments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentEnrolment studentEnrolment = db.Enrolment.Find(id); if (studentEnrolment == null) { return(HttpNotFound()); } return(View(studentEnrolment)); }
// GET: StudentEnrolments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentEnrolment studentEnrolment = db.Enrolment.Find(id); if (studentEnrolment == null) { return(HttpNotFound()); } ViewBag.ModuleId = new SelectList(db.Modules, "Id", "ModuleName", studentEnrolment.ModuleId); ViewBag.StudentId = new SelectList(db.StudentUserAccounts, "Id", "FullName", studentEnrolment.StudentId); return(View(studentEnrolment)); }