public function actionWrite() { parent::actionWrite(); if (isset($_POST['Province'])) { $messages = $this->ValidateData(array(array($_POST['Province']['countryid'], 'emptycountrycode', 'emptystring'), array($_POST['Province']['provincename'], 'emptyprovincename', 'emptystring'))); if ($messages == '') { //$dataku->attributes=$_POST['Province']; if ((int) $_POST['Province']['provinceid'] > 0) { $model = $this->loadModel($_POST['Province']['provinceid']); $model->provincename = $_POST['Province']['provincename']; $model->countryid = $_POST['Province']['countryid']; $model->recordstatus = $_POST['Province']['recordstatus']; } else { $model = new Province(); $model->attributes = $_POST['Province']; } try { if ($model->save()) { $this->DeleteLock($this->menuname, $_POST['Province']['provinceid']); $this->GetSMessage('cciinsertsuccess'); } else { $this->GetMessage($model->getErrors()); } } catch (Exception $e) { $this->GetMessage($e->getMessage()); } } } }