I'm getting an error "object reference not set to an instance of an object"
the code:
It appears that Model is null but I don't know how to fix it
@model IEnumerable<WebApp.Models.Produkt>
<h1>a List</h1>
@if (Model == null || !Model.Any())
{
<p>No products available.</p>
}
else
{
@foreach (var product in Model)
{
if (product != null)
{
<li>
<b>@product.name</b> - @product.category
<a href="@Url.Action("Details", "Warehouse", new { id = product.id })">Details</a>
<button>Delete</button>
</li>
}
}
}It appears that Model is null but I don't know how to fix it