/**
  * Updates an existing UserProfile model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (!($modelProfile = UserProfile::findOne(['user_id' => $id]))) {
         $modelProfile = new UserProfile();
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $modelProfile->user_id = $model->id;
         if ($modelProfile->load(Yii::$app->request->post()) && $modelProfile->save()) {
             return $this->redirect(['index']);
         }
     }
     return $this->render('update', ['model' => $model, 'modelProfile' => $modelProfile]);
 }