public ActionResult Create(Ride ride) { if (ModelState.IsValid) { ride.Bike = _bikeRepository.GetById(ride.Bike.Id); _rideRepository.Add(ride); return RedirectToAction("Index"); } return View(ride); }
public void Update(Ride ride) { _context.Entry(ride).State = System.Data.EntityState.Modified; _context.Save(); }
public void Remove(Ride ride) { _context.Rides.Remove(ride); _context.Save(); }
public void Add(Ride ride) { _context.Rides.Add(ride); _context.Save(); }
public ActionResult Edit(Ride ride) { if (ModelState.IsValid) { ride.BikeId = ride.Bike.Id; _rideRepository.Update(ride); return RedirectToAction("Index"); } return View(ride); }