def put(self, hotel_id):
     dados = Hotel.atributos.parse_args()
     hotel_encontrado = HotelModel.find_hotel(hotel_id)
     if hotel_encontrado:
         hotel_encontrado.update_hotel(**dados)
         hotel_encontrado.save_hotel()
         return hotel_encontrado.convert_json(), 200
     hotel = HotelModel(hotel_id, **dados)
     try:
         hotel.save_hotel()
     except:
         return {
             'message': 'An internal error ocurred trying to save hotel.'
         }, 500  # Internal Server Error
     return hotel.convert_json(), 201  # created
    def post(self, hotel_id):
        if HotelModel.find_hotel(hotel_id):
            return {
                "message": "Hotel id '{}' already exists.".format(hotel_id)
            }, 400  #bad request

        dados = Hotel.atributos.parse_args()
        hotel = HotelModel(hotel_id, **dados)
        try:
            hotel.save_hotel()
        except:
            return {
                'message': 'An internal error ocurred trying to save hotel.'
            }, 500  # Internal Server Error
        return hotel.convert_json()