public static function removeTotalSewadarCount($NomialRollID, $Type = null) { if ($Type == null || $NomialRollID == null) { return false; } $data = NominalRoll::model()->findByPk($NomialRollID); if ($Type == 'Male') { $data->total_male = $data->total_male - 1; } else { if ($Type == 'Female') { $data->total_female = $data->total_female - 1; } } $data->total_sewadar = $data->total_sewadar - 1; return $data->save(); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = NominalRoll::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }