/** * This method is used for alter a client * * @url GET client/{ClientID}/{name}/{phone} */ public function client($ClientID, $name = '', $phone = '') { $Utils = new Utils(); $Client = new Client(); /* Formantando Telefone */ if (strpos($phone, '(') !== false && strpos($phone, ')') !== false && strpos($phone, ' ') !== false && strpos($phone, '-') !== false) { $phoneArr = $Utils->phoneFormatMysql($phone); $phone = $phoneArr['DDD'] . $phoneArr['Phone']; } /* Adicionando as Variaveis de Client */ $Client->Client_ID = $ClientID; $Client->Name = $name; $Client->Phone = $phone; if ($Client->gravarDados()) { return array('Success' => true, "Msg" => "Client has been alter"); } return array('Success' => false, "Msg" => "Can't alter Client"); }
/** * This method is used for create a client * * @url GET client/{name}/{phone} */ public function client($name = '', $phone = '') { $Utils = new Utils(); //echo "<pre>"; //echo("<br />Construindo Objeto Client<br />"); $Client = new Client(); /* Formantando Telefone */ if (strpos($phone, '(') !== false && strpos($phone, ')') !== false && strpos($phone, ' ') !== false && strpos($phone, '-') !== false) { $phoneArr = $Utils->phoneFormatMysql($phone); $phone = $phoneArr['DDD'] . $phoneArr['Phone']; } /* Adicionando as Variaveis de Client */ $Client->Name = $name; $Client->Phone = $phone; if ($Client->gravarDados()) { return array('Success' => true, "Msg" => "Client inserted"); } return array('Success' => false, "Msg" => "Can't insert client into database"); }