magento2 – how to create controller to show product name and stock status (Available/out of stock) in magento?

I want to create a table to show stock status if all products.
This table will contains following fields:
=> Product Name
=> Product SKU
=> Quantity
=> Stock Status (In Stock / Out of Stock)

I tried using object manager.. but not able to find mistake in Stock Status.

Here is my code:


$objectManager = MagentoFrameworkAppObjectManager::getInstance();

$productCollection = $objectManager


$collection = $productCollection->create()
    ->addAttributeToFilter('type_id', array('neq' => 'configurable'))
    ->joinField('stock_item', 'cataloginventory_stock_item', 'qty', 'product_id=entity_id') // add 'qty=0' to get outofstock products

            <td>Stock Status</td>
        $count = 1;
        foreach ($collection as $product) {
                <td><?php echo $count; ?></td>
                <td><?php echo $product->getName(); ?></td>
                <td><?php echo $product->getSku(); ?></td>
                <td><?php if($product->getStockItem()==NULL){echo "-";} else { echo $product->getStockItem(); } ?></td>
                if($product->getStockItem() > 0)
                    echo '<span style="color:green;">In Stock</span>';
                elseif($product->getStockItem() == NULL)
                    echo '<span style="color:blue;">N/A</span>';

                    echo '<span style="color:red;">Out of Stock</span>';
                } ?>
        <?php $count++;
        } ?>