question of multiple choices in APS MVC 5

0

I'm developing a project where it will have multiple choices. My problem is that I am not able to show only the questions I want, for example when clicking on the questions the user will be presented with the question number 1 with the questions, after he finishes, he advances to question number 2 and so on. Home My problem is that I am able to show all information instead of just being specific (I am using the list to show but I did not find an alternative to show only one information).

View Code

<dl class="dl-horizontal">
    <dt>
        @Html.DisplayNameFor(model => model.Questão)
    </dt>

    <dd>
        @Html.DisplayFor(model => model.Questão)
    </dd>
</dl>

Now the Control Code

public ActionResult Index()
    {
        return View(db.Fornecedor.ToList());
    }
    
asked by anonymous 15.06.2017 / 22:00

1 answer

1

To return only one information, use:

public ActionResult Index()
{
    return View(db.Questoes.FirstOrDefault());
}

What will return only one record

Or use Where to return something specific

public ActionResult Index()
{
    return View(db.Questoes.Where(x => x.Questao == 1));
}
    
20.06.2017 / 21:14