I'm using following code:-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID)
Same code I want to use for Magento2, how can I achieve?
Something like:
$this->storeManager->setCurrentStore(0);
Where $this->storeManage is an instance of Magento\Store\Model\StoreManagerInterface
Ex:
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager
) {
$this->storeManager = $storeManager;
}