예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BikeRackModel bikeRackModel = db.BikeRackModels.Find(id);

            db.BikeRackModels.Remove(bikeRackModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        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));
        }
예제 #4
0
        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());
        }
예제 #5
0
        // 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));
        }
예제 #6
0
        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));
        }
예제 #7
0
        public ActionResult EditBikeRackState(int Id)
        {
            BikeRackModel bikeRack = new BikeRackModel();

            return(View("Index"));
        }