/** * Finds the AmgenContactListvalidate model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return AmgenContactListvalidate the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = AmgenContactListvalidate::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Updates an existing User 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); $ag_id = $model->attendee_id; $model1 = AmgenContactListvalidate::findOne($ag_id); $model->scenario = 'update'; if ($model->load(Yii::$app->request->post()) && $model1->load(Yii::$app->request->post()) && $model->validate()) { $fname = $_POST['AmgenContactListvalidate']['first_name']; $lname = $_POST['AmgenContactListvalidate']['last_name']; $model->first_name = $fname; $model->last_name = $lname; $fullname = $fname . " " . $lname; $model1->Name = $fullname; $model->save(false); $model1->save(false); return $this->redirect(['index']); } else { return $this->render('update', ['model' => $model, 'model1' => $model1]); } }