Exemple #1
0
        public async Task<IHttpActionResult> PutRoom(Room room)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
        
            try
            {
                await roomRepository.EditAsync(room);
            }
            catch (Exception ex)
            {
                if (!RoomExists(room.RoomId))
                {
                    return NotFound();
                }
                else
                {
                    throw ex;
                }
            }

            return Ok(room);
        }
Exemple #2
0
        public async Task<IHttpActionResult> PostRoom(Room room)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            await roomRepository.InsertAsync(room);

            return Ok("The room has been inserted");
        }