Example #1
0
 public function actionDelete($id)
 {
     $user = Khachhang::findOne($id);
     if (!empty($user)) {
         $user->status = 0;
         if ($user->save()) {
             return $this->redirect('?r=khachhang/index');
         }
     }
 }
Example #2
0
 /**
  * Finds the Khachhang model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Khachhang the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Khachhang::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 public function actionPreview($id)
 {
     $model = Khachhang::findOne($id);
     return $this->render('preview', ['model' => $model]);
 }