Basically your view is waiting for a Viewmodel GuialetoLMS.Models.GuialetoModel and you’re passing one on to her a different kind,GuialetoLMS.Models.Vestibular.
If you wanted to pass only the Vestibular list, just change the statement in your view:
@model GuialetoLMS.Models.Vestibular
@foreach (var choice in Model)
{
@Html.RadioButton("answer", @choice.idVestibular ) @choice.NomeVestibular
}
Even though you have only included a small snippet of your code I deduce that the first solution will not solve your problem as you should wish to pass other data that are contained in GuialetoModel, then you should create an instance of that object and popular with the content you want.
public ActionResult PaginaQuestao()
{
var viewModel = new GuialetoLMS.Models.GuialetoModel();
//... resto do seu código
viewModel.Vestibular = db.Vestibular.ToList();
return View(viewModel);
}
What is the error, what is happening?
– Leandro Angelo
The model item passed into the Dictionary is of type 'System.Collections.Generic.List`1[Guialetolms.Models.Vestibular]', but this Dictionary requires a model item of type 'Guialetolms.Models.Guialetomodel'.
– Robson Oliveira
The guy you’re passing to the view is wrong
db.Vestibular.ToList()is returning aGuialetoLMS.Models.Vestibularand not a@model GuialetoLMS.Models.GuialetoModel.– user8545