public ActionResult DeleteConfirmed(int id) { trip_share trip_share = db.trip_share.Find(id); db.trip_share.Remove(trip_share); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,driver_id,start_at_date,end_at_date,vehicle_id,created_at,created_by,trip_type_id")] trip_share trip_share) { if (ModelState.IsValid) { db.Entry(trip_share).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.driver_id = new SelectList(db.tbl_accounts, "id", "first_name", trip_share.driver_id); ViewBag.vehicle_id = new SelectList(db.tbl_vehicles, "id", "model", trip_share.vehicle_id); ViewBag.trip_type_id = new SelectList(db.trip_types, "id", "name", trip_share.trip_type_id); return(View(trip_share)); }
// GET: SharedTrips/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } trip_share trip_share = db.trip_share.Find(id); if (trip_share == null) { return(HttpNotFound()); } return(View(trip_share)); }
// GET: trip_share/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } trip_share trip_share = db.trip_share.Find(id); if (trip_share == null) { return(HttpNotFound()); } ViewBag.driver_id = new SelectList(db.tbl_accounts, "id", "first_name", trip_share.driver_id); ViewBag.vehicle_id = new SelectList(db.tbl_vehicles, "id", "model", trip_share.vehicle_id); ViewBag.trip_type_id = new SelectList(db.trip_types, "id", "name", trip_share.trip_type_id); return(View(trip_share)); }