I made this html within my cshtml. I was doing a foreach and gave error in foreach and also did not recognize modelItem. In the Models folder are my edmx, so T_PDV is a BD entity mapped to this edmx.
@model SuporteTecnico.Models.T_PDV
@{
ViewBag.Title = "Formulário";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Pesquisa</title>
</head>
<body>
<table>
<tr>
<th>@Html.DisplayNameFor(model => model.RazaoSocial)</th>
<th>@Html.DisplayNameFor(model => model.CNPJ)</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>@Html.DisplayFor(modelItem => item.RazaoSocial)</td>
<td>@Html.DisplayFor(modelItem => item.CNPJ)</td>
</tr>
}
</table>
</body>
</html>
Below the errors in foreach and DisplayFor respectively
foreach statement cannot operate on variables of type 'V99SuporteTecnico.Models.T_PDV' because 'V99SuporteTecnico.Models.T_PDV' does not contain a public definition for 'GetEnumerator'
The type arguments for method 'System.Web.Mvc.Html.DisplayExtensions.DisplayFor<TModel,TValue>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TValue>>)'
cannot be inferred from the usage. Try specifying the type arguments explicitly.