コード例 #1
0
        public async Task <IActionResult> PutRoomPlan(int id, RoomPlan roomPlan)
        {
            if (id != roomPlan.Id)
            {
                return(BadRequest());
            }

            _context.Entry(roomPlan).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RoomPlanExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Capacity")] Room room)
 {
     if (ModelState.IsValid)
     {
         db.Entry(room).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(room));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Name,Subject,StartDate,EndDate,RoomId")] Reservation reservation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reservation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RoomId = new SelectList(db.Rooms, "Id", "Name", reservation.RoomId);
     return(View(reservation));
 }