public ActionResult DeleteConfirmed(int id) { SubjectChapterSetup subjectChapterSetup = db.SubjectChapterSetups.Find(id); db.SubjectChapterSetups.Remove(subjectChapterSetup); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,ClassId,SubjectId,Name,IsActive")] SubjectChapterSetup subjectChapterSetup) { if (ModelState.IsValid) { db.Entry(subjectChapterSetup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassId = new SelectList(db.Classes.ToList().OrderByDescending(s => s.Id), "Id", "Name", subjectChapterSetup.ClassId);; ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", subjectChapterSetup.SubjectId); return(View(subjectChapterSetup)); }
// GET: SubjectChapterSetups/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SubjectChapterSetup subjectChapterSetup = db.SubjectChapterSetups.Find(id); if (subjectChapterSetup == null) { return(HttpNotFound()); } return(View(subjectChapterSetup)); }
public ActionResult Create([Bind(Include = "Id,SubjectId,Name,IsActive,ClassId")] SubjectChapterSetup subjectChapterSetup) { ViewBag.ClassId = new SelectList(db.Classes.ToList().OrderByDescending(s => s.Id), "Id", "Name", subjectChapterSetup.ClassId); ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", subjectChapterSetup.SubjectId); if (ModelState.IsValid) { db.SubjectChapterSetups.Add(subjectChapterSetup); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(subjectChapterSetup)); }
// GET: SubjectChapterSetups/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SubjectChapterSetup subjectChapterSetup = db.SubjectChapterSetups.Find(id); if (subjectChapterSetup == null) { return(HttpNotFound()); } ViewBag.ClassId = new SelectList(db.Classes.ToList().OrderByDescending(s => s.Id), "Id", "Name", subjectChapterSetup.ClassId); ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", subjectChapterSetup.SubjectId); return(View(subjectChapterSetup)); }