public ActionResult Create([Bind(Include = "TripID,OriginLocation,DestinationLocation,TripType,TripStatus")] Trip trip) { if (ModelState.IsValid) { db.Trips.Add(trip); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(trip)); }
public ActionResult Create([Bind(Include = "DriverID,FirstName,LastName,DOB,IsActive")] Driver driver) { if (ModelState.IsValid) { db.Drivers.Add(driver); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(driver)); }
public Driver AddDriver(Driver driver) { using (DriverEtaContext context = new DriverEtaContext()) { context.Configuration.ProxyCreationEnabled = false; context.Drivers.Add(driver); context.SaveChanges(); } return(driver); }