I need to display all the records in my database to the HTML page.
@model QBKartMVC.Models.Products
@foreach (var item in Model)
{
<tr>
<td><input type="checkbox"></td>
<td>@Html.DisplayFor(x => x.ProductCode)</td>
<td>@Html.DisplayFor(x => x.ProductName)</td>
<td>@Html.DisplayFor(x => x.ProductDes)</td>
<td>@Html.DisplayFor(x => x.ActiveFlag)</td>
<td>@Html.DisplayFor(x => x.Price)</td>
</tr>
}
An expression tree may not contain a dynamic operation is the error showing
public IActionResult Index()
{
var context = new DBContext();
return View(context.Products.ToList());
}
This is the Controller part