public ActionResult DeleteConfirmed(int id) { Yehicle yehicle = db.Yehicles.Find(id); db.Yehicles.Remove(yehicle); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "VehicleID,Make,Model,Year")] Yehicle yehicle) { if (ModelState.IsValid) { db.Entry(yehicle).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(yehicle)); }
public ActionResult Create([Bind(Include = "VehicleID,Make,Model,Year")] Yehicle yehicle) { if (ModelState.IsValid) { db.Yehicles.Add(yehicle); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(yehicle)); }
// GET: Yehicles/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Yehicle yehicle = db.Yehicles.Find(id); if (yehicle == null) { return(HttpNotFound()); } return(View(yehicle)); }