Beispiel #1
0
        public ActionResult Create(Fuel fuel)
        {
            if (ModelState.IsValid)
            {
                db.Fuels.Add(fuel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CarID = new SelectList(db.Cars, "CarID", "Nickname", fuel.CarID);
            return View(fuel);
        }
Beispiel #2
0
 public ActionResult Edit(Fuel fuel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fuel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CarID = new SelectList(db.Cars, "CarID", "Nickname", fuel.CarID);
     return View(fuel);
 }