Can Not Redirect To Page

I am new to YII framework.

Whenever user delete any record then I do not want to delete record physically from database but add "END DATE" field to NOW() value to the record which are going to delete. I have add following code to the controller, it put current datetime to the enddate field but not redirect to the admin page.

public function actionDelete($id)

{


	if(Yii::app()->request->isPostRequest)


	{


	// Check if  product type is connected with other module


		$aCheckDeptEmp = array();


		$aCheckLink = Products::model()->findAll('ptype=:pt', array(':pt'=>$id));


		if(count($aCheckLink) > 0) {


			Yii::app()->user->setFlash('record_linked','PRODUCT TYPE linked with product(s)');


		} else {


			// add current datetime top enddate(edt) field of record


			[b]$model=$this->loadModel($id);


			$model->edt = date("Y-m-d H:i:s");


			$model->save(false);[/b]

[size="5"]//now I want to redirect to view/product/admin page[/size]

			//$this->loadModel($id)->delete();// i dont wan this to delete physically


		}


	// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser


	if(!isset($_GET['ajax']))


		$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));


	}


	else


		throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');


}

For redirect you can use


$this->redirect()

(as a few lines below in your code)

notice: to count products you can use statistical query.


$this->redirect(array('product/admin'));