Trying to do a partial view in ASP.NET with C #, it throws me the following error, it is worth noting that I try to do it in different ways and it keeps marking the same error, it is the first time it happens to me with a view and I do not have idea of why, because if the Model object exists.
How can I solve it?
@model IEnumerable<MvcBackBolsaTrabajo.Models.EntrevistaIdiomaModel>
@foreach (var item in Model) {
<li>
@Html.DisplayFor(modelItem => item.nombreCand) @Html.DisplayFor(modelItem => item.apellidoCnad)
</li>}
Controller
namespace MvcBackBolsaTrabajo.Controllers
{
public class EntrevistaIdiomaController : Controller
{
IdiomaDAO m_idiomasDAO = new IdiomaDAO();
EntrevistaIdiomaDAO m_entrevistaIdiomaDAO = new EntrevistaIdiomaDAO();
// GET: EntrevistaIdioma
public ActionResult Index()
{
return View(m_entrevistaIdiomaDAO.Todos());
}
//Detalle
public ActionResult Details(int id)
{
EntrevistaIdiomaModel entrevistaIdiomaModel = m_entrevistaIdiomaDAO.Obtener(id);
return View(entrevistaIdiomaModel);
}
public ActionResult Notificacion()
{
ViewBag.Notificacion = m_entrevistaIdiomaDAO.TodosXFecha();
return View();
}
Model
namespace MvcBackBolsaTrabajo.Models
{
public class EntrevistaIdiomaModel
{
public int EntrevistaIdiomaID { get; set; }
[DisplayName("Nombre")]
public string nombreCand { get; set; }
[DisplayName("Apellidos")]
public string apellidoCnad { get; set; }
[DisplayName("Fecha")]
public DateTime fecha { get; set; }
[DisplayName("C.Auditiva")]
public string comprencionAuditivaCal { get; set; }
[DisplayName("E.Oral")]
public string expresionOralCal { get; set; }
[DisplayName("E.Escrita")]
public string expresionEscritaCal { get; set; }
[DisplayName("Comentarios")]
public string comentarios { get; set; }
[DisplayName("Vacante")]
public string vacante { get; set; }
[DisplayName("Recomendación")]
public string recomendacion { get; set; }
[DisplayName("Idioma")]
public int IdiomasID { get; set; }
public IdiomaModel Idioma { get; set; }
}
}