Exemplo n.º 1
0
        public async Task <IActionResult> PutRooms([FromRoute] Guid id, [FromBody] Rooms rooms)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != rooms.RoomId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public ActionResult <Room> PutRoom(int id, Room roomItem)
 {
     if (id != roomItem.Id)
     {
         return(BadRequest());
     }
     _context.Entry(roomItem).State = EntityState.Modified;
     _context.SaveChanges();
     return(NoContent());
 }