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