def get_all_Shippers(): c = Shippers(connection_data) result = c.get_all_Shippers() return jsonify({'data': result})
def get_one_shipper(id): shipper = ShippersEntity(ShipperID=id) c = Shippers(connection_data) result = c.get_one_Shippers(shipper) return jsonify({'data': result})
def add_shippers(): data = request.json shippers = ShippersEntity(shipper_name=data['shipper_name'], phone=data['phone'] ) c = Shippers(connection_data) message = c.insert(shippers) if message is None: return jsonify({ 'message': 'Cannot insert data' }), 500 return jsonify({ 'message': message })
def add_Shippers(): data = request.json ship = ShippersEntity(ShipperName=data['ShipperName'], Phone=data['Phone']) c = Shippers(connection_data) message = c.insert_Shippers(ship) if message is None: return jsonify({'message': 'Cannot insert data'}), 500 return jsonify({'message': message})
def delete_Shippers_by_id(id): if request.method == 'DELETE': # Delete user by id shipp = ShippersEntity(ShipperID=id) c = Shippers(connection_data) result = c.delete_Shippers(shipp) return jsonify({'message': result[0]}), result[1] else: # Update user by id data = request.json shipp = ShippersEntity(ShipperID=id, ShipperName=data['ShipperName'], Phone=data['Phone']) c = Shippers(connection_data) result = c.update_Shippers(shipp) return jsonify({'message': result[0]}), result[1]
def delete_shippers_by_id(id): if request.method == 'DELETE': # Delete user by id shippers = ShippersEntity(shipper_id=id) c = Shippers(connection_data) result = c.delete(shippers) return jsonify({ 'message': result[0] }), result[1] else: # Update user by id data = request.json shippers = ShippersEntity(shipper_id=id, shipper_name=data['shipper_name'], phone=data['phone']) c = Shippers(connection_data) result = c.update(shippers) return jsonify({ 'message': result[0] }), result[1]