예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ParkingSpace parkingSpace = db.ParkingSpaces.Find(id);

            db.ParkingSpaces.Remove(parkingSpace);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,Capacity")] ParkingSpace parkingSpace)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parkingSpace).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parkingSpace));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "Id,Capacity")] ParkingSpace parkingSpace)
        {
            if (ModelState.IsValid)
            {
                db.ParkingSpaces.Add(parkingSpace);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(parkingSpace));
        }
예제 #4
0
        public AdvancedViewModel(ParkingSpace park)
        {
            capacity = park.Capacity;
            rows     = capacity / 5;
            array    = park.ps;
            db       = park.db;

            if (capacity % 5 != 0)
            {
                rows++;
            }
        }
예제 #5
0
        // GET: ParkingSpaces/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ParkingSpace parkingSpace = db.ParkingSpaces.Find(id);

            if (parkingSpace == null)
            {
                return(HttpNotFound());
            }
            return(View(parkingSpace));
        }