def getResourceIDByFuelID(self, Fuelid): dao = FuelDAO() row = dao.getResourceIDByFuelID(Fuelid) if not row: return jsonify(Error="Fuel Not Found "), 404 else: Fuel = self.build_fuel_dict(row) return jsonify(Fuel=Fuel)
def updateResourceJson(self, Fuelid, json): dao = FuelDAO() if not dao.getFuelById(Fuelid): return jsonify(Error="Fuel not found."), 404 else: Fueltype = json['FuelType'] Fueloctenage = json['FuelOctenage'] Fueldescription = json['FuelDescription'] if Fueltype and Fueloctenage and Fueldescription: dao.update(Fuelid, Fueltype, Fueloctenage, Fueldescription) resourceid = dao.getResourceIDByFuelID(Fuelid) result = self.build_fuel_attributes(Fuelid, Fueltype, Fueloctenage, Fueldescription, resourceid) return jsonify(Fuel=result), 400 else: return jsonify( Error="Unexpected attributes in update request"), 400