0
The data was entered into the database, but the View does not show one of the fields.
I checked in SQL Server and it’s all right, but the name field returns empty in view
public ActionResult Index()
{
    List<MovimentacaoVM> lispedido;
    using (Db db = new Db())
    {
        lispedido = db.Movimentacao.ToArray()
                      .OrderBy(x => x.MovimentacaoId)
                      .Select(x => new MovimentacaoVM(x)).ToList();
    }
    return View(lispedido);           
}
View code:
@model IEnumerable<PraticaNtoN.Models.MovimentacaoVM>
@{
    ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
    @Html.ActionLink("Create New", "Criar")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ProdutoNome)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ClienteNome)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DataCriacao)
        </th>
        <th></th>
    </tr>
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ProdutoNome)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ClienteNome)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DataCriacao)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.MovimentacaoId }) |
            @Html.ActionLink("Details", "Details", new { id=item.MovimentacaoId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.MovimentacaoId })
        </td>
    </tr>
}
</table>
Method MovimentacaoVM
public MovimentacaoVM(Movimentacao row)
{
    MovimentacaoId = row.MovimentacaoId;
    ClienteId = row.ClienteId;
    DataCriacao = row.DataCriacao;
    ProdutoId = row.ProdutoId;
    ProdutoNome = row.ClienteNome;
    ProdutoNome = row.ProdutoNome;
}
						
You can post the code of view?
– Jéf Bueno
When you speak in "name field" you refer to Productname or Clientename?
– Jéf Bueno
to the clienteName all fields are filled in there in sql server manager, I checked, but when showing in the view comes all fields except the client name
– Cesar Augusto
Post also method code
MovimentacaoVM– Jéf Bueno
Dude, put the code to the method I was talking about up there.
– Jéf Bueno