コード例 #1
0
ファイル: fuel.py プロジェクト: ErickRodz/ResourcesApp
 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)
コード例 #2
0
ファイル: fuel.py プロジェクト: ErickRodz/ResourcesApp
 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