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,
        ]);
    }
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,
        ]);
    }
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 , ] ) ; }
Creates a new FilterType model.
If creation is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
Creates a new FilterType model . If creation is successful the browser will be redirected to the view page .