Esempio n. 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCrear()
 {
     $genero = new Genero();
     if (isset($_POST['Genero'])) {
         $genero->attributes = $_POST['Genero'];
         if ($genero->save()) {
             Yii::app()->user->setFlash('success', 'Género ' . $genero->nombre . ' guardado con éxito');
             $this->redirect(array('view', 'id' => $genero->getPrimaryKey()));
         }
         //if($genero->save())
     }
     //if(isset($_POST['MenuItem']))
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $this->render('crear', array('model' => $genero));
 }