This commit is contained in:
2017-12-27 13:46:56 +01:00
parent 0cc882060c
commit 73d95c3daf
22 changed files with 641 additions and 6 deletions
@@ -30,4 +30,27 @@ class usersController extends MY_Controller {
$this->json( $users );
}
public function saveUser()
{
$userValidation = new UserValidation();
if ( ! $userValidation->getValidationResult() )
return $this->json( [
'success'=> false, 'messages' =>$userValidation->getErrorMessages()] );
$user = $this->input->post();
$userID = $user['id'];
unset($user['id']);
if( $userID == 0 )
{
createNewUser();
}
$userID = User::saveUser( $userID, $user);
$this->json( ['success' => TRUE] );
}
}