Beispiel #1
0
        public ActionResult Create(FillUp fillup)
        {
            if (ModelState.IsValid)
            {
                db.FillUps.Add(fillup);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.VehicleID = new SelectList(db.Vehicles, "ID", "Make", fillup.VehicleID);
            ViewBag.StationID = new SelectList(db.Stations, "ID", "Name", fillup.StationID);
            return View(fillup);
        }
Beispiel #2
0
 public ActionResult Edit(FillUp fillup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fillup).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.VehicleID = new SelectList(db.Vehicles, "ID", "Make", fillup.VehicleID);
     ViewBag.StationID = new SelectList(db.Stations, "ID", "Name", fillup.StationID);
     return View(fillup);
 }