public ActionResult Create(Plane plane) { if (ModelState.IsValid) { db.Planes.Add(plane); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AirlineID = new SelectList(db.Airlines, "AirlineID", "Name", plane.AirlineID); return View(plane); }
public ActionResult Edit(Plane plane) { if (ModelState.IsValid) { db.Entry(plane).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AirlineID = new SelectList(db.Airlines, "AirlineID", "Name", plane.AirlineID); return View(plane); }