/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new SelProducts();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['SelProducts'])) {
         $model->attributes = $_POST['SelProducts'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function actionSaveSelProd()
 {
     if (Yii::app()->session['edit_1st_pdf'] == getCurCusId()) {
         //            echo "ete";exit;
         $this->removeSelectedPoduct(Yii::app()->session['sel_prod']);
     }
     if (count(Yii::app()->session['sel_prod'])) {
         foreach (Yii::app()->session['sel_prod'] as $product) {
             $selPro = SelProducts::model()->findByAttributes(array('product_id' => intval($product), 'cus_id' => intval(getCurCusId())));
             if (!$selPro) {
                 $selPro = new SelProducts();
             }
             $selPro->product_id = intval($product);
             $selPro->cus_id = intval(getCurCusId());
             $selPro->save();
         }
     }
     unset(Yii::app()->session['sel_prod']);
     $this->redirect(array('customer/CustomerQuest'));
 }