public ActionResult DeleteConfirmed(int id) { UnitsSet unitsSet = db.UnitsSet.Find(id); db.UnitsSet.Remove(unitsSet); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,StudentsId")] UnitsSet unitsSet) { if (ModelState.IsValid) { db.Entry(unitsSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentsId = new SelectList(db.StudentsSet, "Id", "FirstName", unitsSet.StudentsId); return(View(unitsSet)); }
// GET: UnitsSets/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UnitsSet unitsSet = db.UnitsSet.Find(id); if (unitsSet == null) { return(HttpNotFound()); } return(View(unitsSet)); }
// GET: UnitsSets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UnitsSet unitsSet = db.UnitsSet.Find(id); if (unitsSet == null) { return(HttpNotFound()); } ViewBag.StudentsId = new SelectList(db.StudentsSet, "Id", "FirstName", unitsSet.StudentsId); return(View(unitsSet)); }