public ActionResult DeleteConfirmed(long id) { PupilsOnCourse pupilsOnCourse = db.PupilsOnCourses.Find(id); db.PupilsOnCourses.Remove(pupilsOnCourse); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Pupils_id,Course_id,Date_from,Date_to")] PupilsOnCourse pupilsOnCourse) { if (ModelState.IsValid) { db.Entry(pupilsOnCourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Course_id = new SelectList(db.Courses, "Id", "Name", pupilsOnCourse.Course_id); ViewBag.Pupils_id = new SelectList(db.Pupils, "Id", "Pupils_last_name", pupilsOnCourse.Pupils_id); return(View(pupilsOnCourse)); }
public ActionResult Create([Bind(Include = "Pupils_id,Course_id,Date_from,Date_to")] PupilsOnCourse pupilsOnCourse) { if (ModelState.IsValid) { db.PupilsOnCourses.Add(pupilsOnCourse); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Course_id = new SelectList(db.Courses, "Id", "Name", pupilsOnCourse.Course_id); ViewBag.Pupils_id = new SelectList(db.Pupils, "Id", "Author_first_name", pupilsOnCourse.Pupils_id); return(View(pupilsOnCourse)); }
// GET: PupilsOnCourses/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PupilsOnCourse pupilsOnCourse = db.PupilsOnCourses.Find(id); if (pupilsOnCourse == null) { return(HttpNotFound()); } return(View(pupilsOnCourse)); }
// GET: PupilsOnCourses/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PupilsOnCourse pupilsOnCourse = db.PupilsOnCourses.Find(id); if (pupilsOnCourse == null) { return(HttpNotFound()); } ViewBag.Course_id = new SelectList(db.Courses, "Id", "Name", pupilsOnCourse.Course_id); ViewBag.Pupils_id = new SelectList(db.Pupils, "Id", "Pupils_last_name", pupilsOnCourse.Pupils_id); return(View(pupilsOnCourse)); }