I have a partial view which receives a list from a controller, that view has a model (ViewModel) ... The problem is that the list does not arrive or does not result in the view ..
//ViewModel
namespace Proyecto_Libreria.Entidades
{
public class Union
{
public Acreedor Acreedor { get; set; }
public Pago Pago { get; set; }
}
}
These are the entities that "come together" in the View
namespace Presupuestador_Libreria.Entidades
{
[Table("ACREEDOR")]
public class Acreedor: EntidadBaseSimple
{
[Column("NOMBRE")]
public String Nombre { get; set; }
[Column("CONCEPTO")]
public String Concepto { get; set; }
}
}
-
namespace Presupuestador_Libreria.Entidades
{
[Table("PAGO")]
public class Pago: EntidadBaseSimple
{
[Column("ACREEDOR_ID")]
[ForeignKey("acreedor")]
public int Id_Acreedor { get; set; }
[Column("NUM_FACT_ACREEDOR")]
public String Factura { get; set; }
public virtual Acreedor acreedor { get; set; }
}
}
This is the controller ...
public ActionResult Listar()
{
List<Acreedor> ListaAcreedor = _BDController.Acreedores.ToList().Where(s => s.Estado == "Activo").ToList();
return View("Listar", ListaAcreedor);
}
And this is the partial view where I have the problem, or the list does not arrive or I have an error when trying to go through it.
@using Proyecto_Libreria.Entidades;
@using Proyecto_Libreria.Controladores;
@model List<Acreedor_Pagos>
<table class="table table-striped">
<thead>
<tr>
<th>Acreedor</th>
<th>Concepto</th>
</tr>
</thead>
<tbody>
@foreach (Acreedor_Pagos obj in Model)
{
<tr>
<th scope="row"> @obj.Acreedor.Nombre </th>
<td> @obj.Acreedor.Concepto </td>
</tr>
}
</tbody>
</table>
What could be the error, thanks!