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()); }
public static void UpdateWith(this Room room, UpdateRoomResource model) { room.Number = model.Number; }