public ActionResult DeleteConfirmed(int id) { drive drive = db.drives.Find(id); db.drives.Remove(drive); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "drives_id,driver_id,bus_id")] drive drive) { if (ModelState.IsValid) { db.Entry(drive).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.bus_id = new SelectList(db.buses, "bus_id", "bus_id", drive.bus_id); ViewBag.driver_id = new SelectList(db.drivers, "driver_id", "driver_name", drive.driver_id); return(View(drive)); }
public ActionResult Create([Bind(Include = "drives_id,driver_id,bus_id")] drive drive) { if (ModelState.IsValid) { db.drives.Add(drive); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.bus_id = new SelectList(db.buses, "bus_id", "bus_id", drive.bus_id); ViewBag.driver_id = new SelectList(db.drivers, "driver_id", "driver_name", drive.driver_id); return(View(drive)); }
// GET: /Drives/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } drive drive = db.drives.Find(id); if (drive == null) { return(HttpNotFound()); } return(View(drive)); }
// GET: /Drives/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } drive drive = db.drives.Find(id); if (drive == null) { return(HttpNotFound()); } ViewBag.bus_id = new SelectList(db.buses, "bus_id", "bus_id", drive.bus_id); ViewBag.driver_id = new SelectList(db.drivers, "driver_id", "driver_name", drive.driver_id); return(View(drive)); }