/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new KartuBersalin();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['KartuBersalin'])) {
         $model->attributes = $_POST['KartuBersalin'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_kartu_bersalin));
         }
     }
     $this->render('create', array('model' => $model));
 }
Example #2
0
 public function actionCreateNotExisting($id)
 {
     $model = new Tbersalin();
     $modelkartu = new KartuBersalin();
     $modelkartu->id_pasien = $id;
     if (isset($_POST['Tbersalin'])) {
         $modelkartu->save();
         $kartu = KartuBersalin::model()->findByAttributes(array('id_pasien' => $id));
         $model->attributes = $_POST['Tbersalin'];
         $model->id_kartu_bersalin = $kartu->id_kartu_bersalin;
         if ($model->save()) {
             $this->redirect(array('pasien/view', 'id' => $id));
         }
     }
     $this->render('create', array('model' => $model));
 }