Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Yehicle yehicle = db.Yehicles.Find(id);

            db.Yehicles.Remove(yehicle);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        // 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));
        }