public function actionUpdate($id)
    {
        if (!empty($id)) {
            $model = Currency::findOne($id);
        }
        else {
            $model = new Currency();
        }

        if (Yii::$app->request->isPost) {
            if ($model->load(Yii::$app->request->post())) {

                if ($model->validate()) {
                    $model->save();
                }
                return $this->redirect(\Yii::$app->request->referrer);
            }
            else {
                throw new Exception();
            }
        }
        return $this->render('update', [
            'model' => $model
        ]);
    }
public function actionUpdate($id)
    {
        if (!empty($id)) {
            $model = Currency::findOne($id);
        }
        else {
            $model = new Currency();
        }

        if (Yii::$app->request->isPost) {
            if ($model->load(Yii::$app->request->post())) {

                if ($model->validate()) {
                    $model->save();
                }
                return $this->redirect(\Yii::$app->request->referrer);
            }
            else {
                throw new Exception();
            }
        }
        return $this->render('update', [
            'model' => $model
        ]);
    }
public function actionUpdate ( $ id ) { if ( ! empty ( $ id ) ) { $ model = Currency :: findOne ( $ id ) ; } else { $ model = new Currency ( ) ; } if ( Yii :: $ app -> request -> isPost ) { if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> validate ( ) ) { $ model -> save ( ) ; } return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; } else { throw new Exception ( ) ; } } return $ this -> render ( 'update' , [ 'model' => $ model ] ) ; }
Updates an existing Currency model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
@throws Exception
Updates an existing Currency model . If update is successful the browser will be redirected to the view page .