Пример #1
0
 /**
  * Creates a new Curso model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Curso();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 /**
  * Creates a new Curso model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Curso();
     $dir = new Direccion();
     if ($model->load(Yii::$app->request->post()) && $dir->load(Yii::$app->request->post())) {
         $model->save();
         $dir->Cursoid_curso = $model->id_curso;
         if ($dir->save()) {
             return $this->redirect(['view', 'id' => $model->id_curso]);
         } else {
             return $this->redirect(['index', 'id' => $model->id_curso]);
         }
     } else {
         return $this->render('create', ['model' => $model, 'dir' => $dir]);
     }
 }