public function Execute($db, $asset) { $assets = new SQLAssets($db); //$assets = new MongoAssets($db); if ($assets->RemoveAsset($asset->ID)) { header("HTTP/1.1 204 No Content"); exit; } else { header("HTTP/1.1 404 Not Found"); echo 'Asset not found'; exit; } }
public function Execute($db, $params) { $response = array(); $assetID = null; if (!isset($params["AssetID"]) || !UUID::TryParse($params["AssetID"], $assetID)) { $response['Success'] = FALSE; $response['Message'] = 'missing required parameters'; } else { $assets = new SQLAssets($db); //$assets = new MongoAssets($db); //$assets = new FSAssets($db); if ($assets->RemoveAsset($assetID)) { $response['Success'] = TRUE; } else { $response['Success'] = FALSE; $response['Message'] = 'failed to remove the asset'; } } header("Content-Type: application/json", true); echo json_encode($response); exit; }