public function actionDelete($id)
{
if (Yii::app()->getRequest()->getIsPostRequest()) {
$this->loadModel($id)->delete();
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('DeliveryModule.delivery', 'Record removed!'));
if (!isset($_GET['ajax'])) {
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : ['index']);
}
} else {
throw new CHttpException(400, Yii::t('DeliveryModule.delivery', 'Unknown request. Don\'t repeat it please!'));
}
}