示例#1
0
        public async Task <IActionResult> Put(int hotelId, int id, UpdateRoomResource model)
        {
            var room = await this.context.Rooms.FindAsync(id);

            if (room == null)
            {
                return(this.NotFound());
            }

            room.UpdateWith(model);
            this.context.Rooms.Update(room);
            await this.context.SaveChangesAsync();

            return(this.NoContent());
        }
示例#2
0
 public static void UpdateWith(this Room room, UpdateRoomResource model)
 {
     room.Number = model.Number;
 }