Esempio n. 1
0
});
$app->get('/getIngredientByRecette/:recetteId', function ($recetteId) {
    //renvoi les ingrédients de la recette
    $ingredient = Ingredient::getIngredientByRecette($recetteId);
});
$app->post('/AddIngredient', function () {
    //Ajoute un ingredient
    $ingredient = Ingredient::AddIngredient($_POST["nom"], $_POST["prix"], $_POST["unite"]);
});
$app->put('/ModifIngredient', function () {
    //Ajoute un ingredient
    $ingredient = Ingredient::ModifIngredient($_POST["nom"], $_POST["prix"], $_POST["unite"], $_POST["id"]);
});
$app->delete('/DelIngredient', function () {
    //Ajoute un ingredient
    $ingredient = Ingredient::DelIngredient($_POST["id"]);
});
/*--------------------------------------------------
						CATEGORY
--------------------------------------------------*/
$app->get('/getCategoryName/:categoryId', function ($categoryId) {
    //Retourne le nom de la catégorie de l'id passé en paramètre
    $category = Categorie::getCategoryName($categoryId);
});
$app->get('/getCategoryID/:categoryName', function ($categoryName) {
    //Retourne l'id  de la catégorie avec pour nom celui passé en paramètre
    $category = Categorie::getCategoryId($categoryId);
});
$app->get('/getAllCategory', function () {
    //renvoi toutes les catégories
    $categorie = Categorie::getAllCategory();