public ActionResult Save(BikeRent rent) { if (ModelState.IsValid) { db.BikeRents.Add(rent); var bike = db.BikeRegisters.SingleOrDefault(e => e.BikeNum == rent.BikeId); if (bike == null) { return(HttpNotFound("Bike Number is not valid")); } bike.Available = "no"; db.Entry(bike).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rent)); }
public void Update(BikeRent bike) { this.BikeRentDataProvider.Update(bike); }
public void Add(BikeRent bike) { this.BikeRentDataProvider.Add(bike); }
public void Update(BikeRent rent) { AppDbContext.Entry(rent).State = EntityState.Modified; AppDbContext.BikeRents.Update(rent); AppDbContext.SaveChanges(); }
public void Add(BikeRent rent) { AppDbContext.Entry(rent).State = EntityState.Added; AppDbContext.BikeRents.Add(rent); AppDbContext.SaveChanges(); }
public BikeRentResult(BikeRent bikeRent) { BikeRent = bikeRent; }