Skip to content

Commit

Permalink
🐛 APP #270 put quase funcionando
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 27, 2022
1 parent e9dccf9 commit 5916aa5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions appexemplo_v2.0/api/api_controllers/Acesso_perfilAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ public static function selectById(Request $request, Response $response, array $a
public static function save(Request $request, Response $response, array $args)
{
$vo = new \Acesso_perfilVO;
$msg = \Message::GENERIC_INSERT;
if($request->getMethod() == 'PUT'){
$msg = \Message::GENERIC_UPDATE;
$result = self::selectByIdInside($args);
$bodyRequest = $result[0];
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo);
} else {
$msg = \Message::GENERIC_INSERT;
$vo = TGenericAPI::setObjVoInset($request,$vo);
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo);
}
$bodyRequest = json_decode($request->getBody(),true);
if(empty($bodyRequest)){
$bodyRequest = $request->getParsedBody();
}
$vo = \FormDinHelper::setPropertyVo($bodyRequest,$vo);
$controller = new \Acesso_perfil;
$controller->save($vo);
$response = TGenericAPI::getBodyJson($msg,$response);
Expand Down

0 comments on commit 5916aa5

Please sign in to comment.