public ActionResult DeleteConfirmed(int id) { Vehcile vehcile = db.Vehciles.Find(id); db.Vehciles.Remove(vehcile); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,OwnerId,Make,Model,Year")] Vehcile vehcile) { if (ModelState.IsValid) { db.Entry(vehcile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OwnerId = new SelectList(db.Owners, "Id", "FirstName", vehcile.OwnerId); return(View(vehcile)); }
public ActionResult Create([Bind(Include = "Id,OwnerId,Make,Model,Year")] Vehcile vehcile) { if (ModelState.IsValid) { db.Vehciles.Add(vehcile); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OwnerId = new SelectList(db.Owners, "Id", "FirstName", vehcile.OwnerId); return(View(vehcile)); }
// GET: Vehciles/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Vehcile vehcile = db.Vehciles.Find(id); if (vehcile == null) { return(HttpNotFound()); } return(View(vehcile)); }
// GET: Vehciles/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Vehcile vehcile = db.Vehciles.Find(id); if (vehcile == null) { return(HttpNotFound()); } ViewBag.OwnerId = new SelectList(db.Owners, "Id", "FirstName", vehcile.OwnerId); return(View(vehcile)); }