public ActionResult DeleteConfirmed(int id) { ParkingSpace parkingSpace = db.ParkingSpaces.Find(id); db.ParkingSpaces.Remove(parkingSpace); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
public ActionResult Create([Bind(Include = "Id,Capacity")] ParkingSpace parkingSpace) { if (ModelState.IsValid) { db.ParkingSpaces.Add(parkingSpace); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(parkingSpace)); }
public AdvancedViewModel(ParkingSpace park) { capacity = park.Capacity; rows = capacity / 5; array = park.ps; db = park.db; if (capacity % 5 != 0) { rows++; } }
// 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)); }