def editMenuItem(restaurant_id, menu_id): if request.method == 'POST': restaurant_dao.updateMenuItem(menu_id, request.form['name'], request.form['course'], request.form['price'], request.form['description']) flash("Edited menu item!") return redirect(url_for('restaurantMenu', restaurant_id=restaurant_id)) else: restaurant = restaurant_dao.getRestaurant(restaurant_id) item = restaurant_dao.getMenuItemByRestaurant(restaurant_id, menu_id) return render_template('edit-menu-item.html', restaurant=restaurant, item=item)
def deleteMenuItem(restaurant_id, menu_id): if request.method == 'POST': restaurant_dao.deleteMenuItem(menu_id) flash("Menu item deleted!") return redirect(url_for('restaurantMenu', restaurant_id=restaurant_id)) else: restaurant = restaurant_dao.getRestaurant(restaurant_id) item = restaurant_dao.getMenuItemByRestaurant(restaurant_id, menu_id) return render_template('delete-menu-item.html', restaurant=restaurant, item=item)
def restaurantMenuItem(restaurant_id, menu_id): restaurant = restaurant_dao.getRestaurant(restaurant_id) item = restaurant_dao.getMenuItemByRestaurant(restaurant_id, menu_id) return render_template('menu-item.html', restaurant=restaurant, item=item)
def restaurantMenuItemJSON(restaurant_id, menu_id): item = restaurant_dao.getMenuItemByRestaurant(restaurant_id, menu_id) return jsonify(MenuItem=item.serialize)