public ActionResult DeleteConfirmed(int id)
        {
            NewTrailer newTrailer = db.NewTrailers.Find(id);

            db.NewTrailers.Remove(newTrailer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "TrailerId,reg,TrailerSize,Status,Location,Destination")] NewTrailer newTrailer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(newTrailer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(newTrailer));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "TrailerId,reg,TrailerSize,Status,Location,Destination")] NewTrailer newTrailer)
        {
            if (ModelState.IsValid)
            {
                db.NewTrailers.Add(newTrailer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(newTrailer));
        }
        // GET: NewTrailers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NewTrailer newTrailer = db.NewTrailers.Find(id);

            if (newTrailer == null)
            {
                return(HttpNotFound());
            }
            return(View(newTrailer));
        }