public ActionResult DeleteConfirmed(int id) { BikeRackModel bikeRackModel = db.BikeRackModels.Find(id); db.BikeRackModels.Remove(bikeRackModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Route_Number,Bus_Number,Bike_Rack_1,Bike_Rack_2,Bike_Rack_3,IsActive_Bike_Rack_1,IsActive_Bike_Rack_2,IsActive_Bike_Rack_3")] BikeRackModel bikeRackModel) { if (ModelState.IsValid) { db.Entry(bikeRackModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bikeRackModel)); }
public ActionResult Create([Bind(Include = "Id,Route_Number,Bus_Number,Bike_Rack_1,Bike_Rack_2,Bike_Rack_3,IsActive_Bike_Rack_1,IsActive_Bike_Rack_2,IsActive_Bike_Rack_3")] BikeRackModel bikeRackModel) { if (ModelState.IsValid) { db.BikeRackModels.Add(bikeRackModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bikeRackModel)); }
public ActionResult Index() { BikeRackModel bikeStatus = new BikeRackModel(); //Connecting to Database BikeRackCheckerContext db = new BikeRackCheckerContext(); ViewBag.BusRoute = new SelectList(db.BikeRackModels, "Id", "Route_Number"); ViewBag.BusNumber = new SelectList(db.BikeRackModels, "Id", "Bus_Number"); return(View()); }
// GET: BikeRack/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BikeRackModel bikeRackModel = db.BikeRackModels.Find(id); if (bikeRackModel == null) { return(HttpNotFound()); } return(View(bikeRackModel)); }
public ActionResult EditBikeRackState([Bind(Include = "Id,IsActive_Bike_Rack_1,IsActive_Bike_Rack_2,IsActive_Bike_Rack_3")] BikeRackModel bikeRackModel) { BikeRackCheckerContext db = new BikeRackCheckerContext(); BikeRackModel bikeRack = new BikeRackModel(); if (ModelState.IsValid) { var old_model = db.BikeRackModels.SingleOrDefault(x => x.Id == bikeRackModel.Id); old_model = bikeRackModel; //if (bikeRack.IsActive_Bike_Rack_1 == false) //{ // bikeRack.IsActive_Bike_Rack_1 = true; //} else //{ // bikeRack.IsActive_Bike_Rack_1 = false; //} db.Entry(old_model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bikeRackModel)); }
public ActionResult EditBikeRackState(int Id) { BikeRackModel bikeRack = new BikeRackModel(); return(View("Index")); }