Esempio n. 1
0
 /**
  * Creates a new FilterType model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionSave($id = null)
 {
     if (!empty($id)) {
         $model = $this->findModel($id);
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             return $this->redirect(['save', 'id' => $model->id]);
         }
     } else {
         $model = new FilterType();
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             return $this->redirect(['save', 'id' => $model->id]);
         }
     }
     return $this->render('save', ['model' => $model]);
 }