I have a table / model called ItemPriceFactory:
public class ItemTabelaPreco
{
public string Nome { get; set; }
public decimal ValorUnitario { get; set; }
public int QtdPacote { get; set; }
public decimal ValorPacote { get; set; }
public int TabelaPrecoId { get; set; }
}
And another called Trim Table:
public class TabelaPreco
{
public int Id { get; set; }
public string Nome { get; set; }
public decimal Valor { get; set; }
public IEnumerable<ItemTabelaPreco> ListaItemTabelaPreco { get; set; }
}
In the view of the FastPath table I load the QuickPathItem List without problems:
@model Aplicativo.Models.TabelaPreco
@foreach (var list in Model.ListaItemTabelaPreco)
{
@Html.Raw(list.Nome)
@Html.TextBoxFor(Model => list.ValorUnitario)
@Html.TextBoxFor(Model => list.QtdPacote)
@Html.TextBoxFor(Model => list.ValorPacote)
}
The problem I have is when it is time to retrieve the values from this list of the view in the edition of TablePreco in the controller after the post, I have tried in several ways and always comes the empty list, the other fields that are not of that list, comes the values correctly:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(TabelaPreco tabelaPrecoModel)
{
tabelaPrecoModel.ListaItemTabelaPreco VEM SEMPRE NULL.
}
If anyone can help, thank you in advance.