/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Equipment();
     $model->status = 1;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Equipment'])) {
         $model->attributes = $_POST['Equipment'];
         if ($model->save()) {
             if (isset($_POST['component'])) {
                 $this->redirect(array('components/view', 'id' => $model->componentId));
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     $component = false;
     if (isset($_GET['componentId'])) {
         $componentId = $_GET['componentId'];
         $component = Components::model()->findByPk($componentId);
         if (!$component) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     $this->render('create', array('model' => $model, 'component' => $component));
 }