/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Condominio(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Condominio'])) { $model->attributes = $_POST['Condominio']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->Codice)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new condominio */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "condominio", "action" => "index")); } $condominio = new Condominio(); $condominio->nombre = $this->request->getPost("nombre"); if (!$condominio->save()) { foreach ($condominio->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "condominio", "action" => "new")); } $this->flash->success("condominio was created successfully"); return $this->dispatcher->forward(array("controller" => "condominio", "action" => "index")); }