/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Khachhang();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Khachhang'])) {
         $model->attributes = $_POST['Khachhang'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
 /**
  * Thêm mới khách hàng
  */
 public function actionCreate()
 {
     $model = new Khachhang('Dang_ky');
     if (isset($_POST['Khachhang'])) {
         $model->attributes = $_POST['Khachhang'];
         if ($model->validate()) {
             $model->anh_dai_dien = Khachhang::DEFAULT_AVARTAR;
             $model->password = md5($model->password);
             //Lưu thông tin khách hàng và redirect trang
             if ($model->save(false)) {
                 $this->redirect(array('admin'));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }