<?php
class CancelAction extends BaseAction
{
    public function run()
    {
        $id = Yii::app()->request->getQuery('id');
        $demand = Demands::model()->findByPk($id);
        if (!empty($demand))
        {
            $demand->status = 2;
            $demand->save();
        }
        
        $this->getController()->redirect(array('list'));
    }
}