Skip to content

Commit

Permalink
🔨 APP #270 melhorando delete
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 27, 2022
1 parent e567a12 commit 5a335d9
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions appexemplo_v2.0/api/api_controllers/Acesso_perfilAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,25 @@ public static function save(Request $request, Response $response, array $args)
//--------------------------------------------------------------------------------
public static function delete(Request $request, Response $response, array $args)
{
$id = $args['id'];
$controller = new \Acesso_perfil;
$msg = $controller->delete($id);
if($msg==true){
$msg = \Message::GENERIC_DELETE;
$msg = $msg.' id='.$id;
try{
$result = self::selectByIdInside($args);
if( empty($result) ){
throw new \DomainException('Registro não existe');
}

$id = $args['id'];
$controller = new \Acesso_perfil;
$msg = $controller->delete($id);
if($msg==true){
$msg = \Message::GENERIC_DELETE;
$msg = $msg.' id='.$id;
}
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
} catch ( \Exception $e) {
$msg = $e->getMessage();
$response = TGenericAPI::getBodyJson($msg,$response,500);
return $response;
}
$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
}
}

0 comments on commit 5a335d9

Please sign in to comment.