| @@ 66-77 (lines=12) @@ | ||
| 63 | * If creation is successful, the browser will be redirected to the 'view' page. |
|
| 64 | * @return mixed |
|
| 65 | */ |
|
| 66 | public function actionCreate() |
|
| 67 | { |
|
| 68 | $model = new User(); |
|
| 69 | ||
| 70 | if ($model->load(Yii::$app->request->post()) && $model->create(false)) { |
|
| 71 | return $this->redirect(['view', 'id' => $model->id]); |
|
| 72 | } else { |
|
| 73 | return $this->render('create', [ |
|
| 74 | 'model' => $model, |
|
| 75 | ]); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Updates an existing User model. |
|
| @@ 85-96 (lines=12) @@ | ||
| 82 | * @param integer $id |
|
| 83 | * @return mixed |
|
| 84 | */ |
|
| 85 | public function actionUpdate($id) |
|
| 86 | { |
|
| 87 | $model = $this->findModel($id); |
|
| 88 | ||
| 89 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
| 90 | return $this->redirect(['view', 'id' => $model->id]); |
|
| 91 | } else { |
|
| 92 | return $this->render('update', [ |
|
| 93 | 'model' => $model, |
|
| 94 | ]); |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * Deletes an existing User model. |
|