issue of multiple choices in APS MVC 5

Asked

Viewed 99 times

0

I’m developing a project where he’ll 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 would appear to the user the question number 1 with the questions ,after it ends, advances to question number 2 so on.
My problem is that I am able to show all the information instead of just being one in specific(I am using to list to show but I did not find an alternative to show only one information).

Code of the View

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

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

Now the code of Control

public ActionResult Index()
    {
        return View(db.Fornecedor.ToList());
    }
  • Fornecedor?

  • Name of the bank where the questions are (forgot to change ) but would be questions

1 answer

1


To return only one information, use:

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

That will return you only a record

Or use Where to return something specific

public ActionResult Index()
{
    return View(db.Questoes.Where(x => x.Questao == 1));
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.