<?php

namespace FiloBlu\Flow\Controller\Adminhtml\Inboundflow;

use Exception;
use Magento\Backend\App\Action;
use Magento\Framework\View\Result\PageFactory;

/**
 * Class Delete
 * @package FiloBlu\Flow\Controller\Adminhtml\Inboundflow
 */
class Delete extends Action
{
    /**
     * @var PageFactory
     */
    public function execute()
    {
        $id = $this->getRequest()->getParam('id');
        try {
            $banner = $this->_objectManager->get('FiloBlu\Flow\Model\Inboundflow')->load($id);
            $banner->delete();
            $this->messageManager->addSuccess(
                __('Delete successfully !')
            );
        } catch (Exception $e) {
            $this->messageManager->addError($e->getMessage());
        }
        $this->_redirect('*/*/');
    }
}
