C#C
C#2y ago
IamMax420

I'm getting an error "object reference not set to an instance of an object"

the code: @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
Was this page helpful?