public ActionResult DeleteConfirmed(int id) { StudentRankDetail studentRankDetail = db.StudentRankDetails.Find(id); db.StudentRankDetails.Remove(studentRankDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "StudentRankDetialID,StudentID,RankID")] StudentRankDetail studentRankDetail) { if (ModelState.IsValid) { db.Entry(studentRankDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RankID = new SelectList(db.Ranks, "RankID", "Rank_Name", studentRankDetail.RankID); ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", studentRankDetail.StudentID); return(View(studentRankDetail)); }
// GET: StudentRankDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentRankDetail studentRankDetail = db.StudentRankDetails.Find(id); if (studentRankDetail == null) { return(HttpNotFound()); } return(View(studentRankDetail)); }
// GET: StudentRankDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentRankDetail studentRankDetail = db.StudentRankDetails.Find(id); if (studentRankDetail == null) { return(HttpNotFound()); } ViewBag.RankID = new SelectList(db.Ranks, "RankID", "Rank_Name", studentRankDetail.RankID); ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", studentRankDetail.StudentID); return(View(studentRankDetail)); }
public ActionResult Create([Bind(Include = "StudentID,StudentName,DateOfBirth,DateOfJoining,Student_Phone,Student_Email,Student_Address,isActive,isAdult")] Student student) { if (ModelState.IsValid) { db.Students.Add(student); db.SaveChanges(); StudentRankDetail sr = new StudentRankDetail(); sr.StudentID = student.StudentID; sr.RankID = 2; db.StudentRankDetails.Add(sr); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }