git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@57 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2016-01-29 16:51:39 +00:00
parent ccdece692a
commit 5b0e7d9aa9
3 changed files with 61 additions and 3 deletions
+30
View File
@@ -127,8 +127,38 @@ $app->post('/ricetta/body', function () use ($app) {
$pos = $pos + 1;
}
$retValue["ricettaID"] = $retNewID;
$retValue["message"] = "Ricetta inserita con successo";
} catch (Exception $e) {
$retValue["result"] = false;
$retValue["message"] = $e->getMessage();
}
$mysqlconnetion->disconnetti();
returnJson($app, $callbackFn, $retValue);
});
$app->delete('/ricetta/:itemID', function ($itemID) use ($app) {
$callbackFn = $app->request()->get('callback');
$retValue["result"] = true;
$retValue["message"] = "";
$mysqlconnetion = new MysqlClass;
try {
$queryDelete = "DELETE FROM immagini where id_ricette = " . $itemID;
$mysqlconnetion->executeQuery($queryDelete);
$queryDelete = "DELETE FROM blocco_note where ricetta_id = " . $itemID;
$mysqlconnetion->executeQuery($queryDelete);
$queryDelete = "DELETE FROM ingredienti where ID_RICETTE = " . $itemID;
$mysqlconnetion->executeQuery($queryDelete);
$queryDelete = "DELETE FROM ricette where ID = " . $itemID;
$mysqlconnetion->executeQuery($queryDelete);
$retValue["message"] = "Ricetta cancellata con successo";
} catch (Exception $e) {
$retValue["result"] = false;
$retValue["message"] = $e->getMessage();
}