Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            drive drive = db.drives.Find(id);

            db.drives.Remove(drive);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        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));
        }
Exemple #4
0
        // 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));
        }
Exemple #5
0
        // 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));
        }