public async Task <IActionResult> Edit(int id, [Bind("ID,RoomNumber")] CourtRoom courtRoom) { if (id != courtRoom.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(courtRoom); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourtRoomExists(courtRoom.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(courtRoom)); }
public ActionResult DeleteConfirmed(int id) { CourtRoom courtRoom = db.CourtRooms.Find(id); db.CourtRooms.Remove(courtRoom); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,RoomNumber")] CourtRoom courtRoom) { if (ModelState.IsValid) { db.Entry(courtRoom).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(courtRoom)); }
public ActionResult Create([Bind(Include = "ID,RoomNumber")] CourtRoom courtRoom) { if (ModelState.IsValid) { db.CourtRooms.Add(courtRoom); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(courtRoom)); }
public async Task <IActionResult> Create([Bind("ID,RoomNumber")] CourtRoom courtRoom) { if (ModelState.IsValid) { _context.Add(courtRoom); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(courtRoom)); }
// GET: CourtRooms/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CourtRoom courtRoom = db.CourtRooms.Find(id); if (courtRoom == null) { return(HttpNotFound()); } return(View(courtRoom)); }