def get_one_order(id): order = OrdersEntity(OrderID=id) c = Orders(connection_data) result = c.get_one_Orders(order) return jsonify({'data': result})
def add_orders(): data = request.json orders = OrdersEntity(customer_id =data['customer_id'], employee_id=data['employee_id'], orderdate=data['orderdate'], shipper_id=data['shipper_id'] ) c = Orders(connection_data) message = c.insert(orders) if message is None: return jsonify({ 'message': 'Cannot insert data' }), 500 return jsonify({ 'message': message })
def add_Orders(): data = request.json order = OrdersEntity(CustomerID=data['CustomerID'], EmployeeID=data['EmployeeID'], OrderDate=data['OrderDate'], ShipperID=data['ShipperID']) c = Orders(connection_data) message = c.insert_Orders(order) if message is None: return jsonify({'message': 'Cannot insert data'}), 500 return jsonify({'message': message})
def delete_Orders_by_id(id): if request.method == 'DELETE': # Delete user by id order = OrdersEntity(OrderID=id) c = Orders(connection_data) result = c.delete_Orders(order) return jsonify({'message': result[0]}), result[1] else: # Update user by id data = request.json order = OrdersEntity(OrderID=id, CustomerID=data['CustomerID'], EmployeeID=data['EmployeeID'], OrderDate=data['OrderDate'], ShipperID=data['ShipperID']) c = Orders(connection_data) result = c.update_Orders(order) return jsonify({'message': result[0]}), result[1]
def delete_orders_by_id(id): if request.method == 'DELETE': # Delete user by id orders = OrdersEntity(order_id=id) c = Orders(connection_data) result = c.delete(orders) return jsonify({ 'message': result[0] }), result[1] else: # Update user by id data = request.json orders= OrdersEntity(order_id=id, customer_id =data['customer_id'], employee_id=data['employee_id'], orderdate=data['orderdate'], shipper_id=data['shipper_id'] ) c = Orders(connection_data) result = c.update(orders) return jsonify({ 'message': result[0] }), result[1]
def get_all_orders(): c = Orders(connection_data) result = c.get_all() return jsonify({ 'data': result })