/** * Creates a new Persona model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Persona(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Persona model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Persona(); if ($model->load(Yii::$app->request->post()) && $this->negocio->savePersona($model)) { return $this->redirect(['site/login']); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new InscripcionExamen model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $modelInscripcionExamen = [new InscripcionExamen()]; $modelPersona = new Persona(); $InscripcionNegocio = new InscripcionNegocio(); if ($modelPersona->load(Yii::$app->request->post())) { $modelPersona->ciudad = "Santa Cruz"; $valid = $modelPersona->validate(); if ($valid) { $InscripcionNegocio->RegistrarInscripcion($modelPersona, $modelInscripcionExamen); } else { return $this->render('create', ['modelsInscripcion' => $modelInscripcionExamen, 'modelPersona' => $modelPersona]); } return $this->redirect(['view', 'id' => $modelPersona->id]); } else { return $this->render('create', ['modelsInscripcion' => $modelInscripcionExamen, 'modelPersona' => $modelPersona]); } }
/** * Creates a new Persona model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Persona(); $modelAdmin = new Administrador(); $modelProfesional = new Profesional(); $modelPaciente = new Paciente(); if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->perfil == 1) { $model->save(false); $modelAdmin->persona_id = $model->id; $modelAdmin->save(false); if ($model->save(false)) { return $this->redirect(['view', 'id' => $model->id]); } } else { if ($model->perfil == 2) { $model->save(false); $modelProfesional->persona_id = $model->id; $modelProfesional->save(false); if ($model->save(false)) { return $this->redirect(['view', 'id' => $model->id]); } } else { if ($model->perfil == 3) { $model->save(false); $modelPaciente->persona_id = $model->id; $modelPaciente->descripcion = $model->descripcion; $modelPaciente->save(false); if ($model->save(false)) { return $this->redirect(['view', 'id' => $model->id]); } } } } } else { return $this->render('create', ['model' => $model]); } }