public function postAddCategory() { $category = new JobCategory(); $category->category = $_POST['name']; $category->save(); return 1; }
public function save() { $jobCatId = $this->getValue('jobCategoryId'); if (!empty($jobCatId)) { $jobCat = $this->getJobCategoryService()->getJobCategoryById($jobCatId); } else { $jobCat = new JobCategory(); } $jobCat->setName($this->getValue('name')); $jobCat->save(); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new JobCategory(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['JobCategory'])) { $model->attributes = $_POST['JobCategory']; if ($model->save()) { $this->redirect(array('admin')); } } $this->render('create', array('model' => $model)); }