public bool UpdateService(Service service) { try { db.Entry(service).State = EntityState.Modified; return(true); } catch (Exception) { return(false); } }
public ActionResult Edit([Bind(Include = "ServiceID,Name,ServiceText")] Service service) { if (ModelState.IsValid) { db.Entry(service).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(service)); }
public ActionResult Edit([Bind(Include = "FlightID,FlightClassID,From,Destination,CompanyName,Departure,Price,DepartureTime,Capacity")] Flight flight) { if (ModelState.IsValid) { db.Entry(flight).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FlightClassID = new SelectList(db.FlightClasses, "FlightClassID", "FlightClassKind", flight.FlightClassID); return(View(flight)); }