Пример #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new TiUser();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['TiUser'])) {
         $model->attributes = $_POST['TiUser'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->Email));
         }
     }
     $this->render('create', array('model' => $model));
 }
Пример #2
0
 public function actionIndex()
 {
     if (!isset($_POST['User'])) {
         new Error(4, "User");
     }
     $user = json_decode($_POST['User'], true);
     //var_dump($user);
     if (!$this->verifyInfo($user)) {
         new Error(3);
     }
     $tiUser = new TiUser();
     $tiUser->attributes = $user;
     //echo $tiUser->Account;
     //var_dump($tiUser);
     try {
         if (!$tiUser->save()) {
             new Error(5, null, json_encode($tiUser->getErrors()));
         }
     } catch (Exception $e) {
         new Error(5, null, $e->getMessage());
     }
     new Error(1);
 }