示例#1
0
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)
示例#2
0
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)
示例#3
0
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)
示例#4
0
def restaurantMenuItemJSON(restaurant_id, menu_id):
  item = restaurant_dao.getMenuItemByRestaurant(restaurant_id, menu_id)
  return jsonify(MenuItem=item.serialize)