This is my controller:
public ActionResult Index()
{
IEnumerable<ent.RRHH_SEDE> listar = db.TraerTodo();
Enumerable<mod.RRHH_SEDEModel> entidad = Mapper.Map<IEnumerable<ent.RRHH_SEDE>, IEnumerable<mod.RRHH_SEDEModel>>(listar);
return View(entidad);
}
This is my view:
<td nowrap>
@Html.DisplayFor(modelItem => item.UBICACION)
</td>
<td nowrap>
@Html.DisplayFor(modelItem => item.RRHH_MUNICIPIO.COD_DEPARTAMENTO) ///NO ME MUESTRA DATOS
</td>
My model
public class RRHH_SEDEModel
{
public short COD_SEDE { get; set; }
public string NOMBRE { get; set; }
public string UBICACION { get; set; }
public virtual RRHH_AREA_SEDE RRHH_AREA_SEDE { get; set; }
public virtual RRHH_MUNICIPIO RRHH_MUNICIPIO { get; set; }
public virtual SEG_ESTADO SEG_ESTADO { get; set; }
}
}
But it does not show me data in the view, it only shows me the ones of the class sede
.
Departamento
and Municipio
come out empty.