Beispiel #1
0
        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));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            CourtRoom courtRoom = db.CourtRooms.Find(id);

            db.CourtRooms.Remove(courtRoom);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 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));
 }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "ID,RoomNumber")] CourtRoom courtRoom)
        {
            if (ModelState.IsValid)
            {
                db.CourtRooms.Add(courtRoom);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(courtRoom));
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
        // 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));
        }