Определил. Я просто не весь код выложил.
Вот get:
[HttpGet]
public ActionResult Testing(int id)
{
List<UserAnswer> userAnswers = new List<UserAnswer>();
var questions = (from question in db.Questions
where question.TestID == id
select question).ToList();
foreach (var questionItem in questions)
{
var correctAnswers = questionItem.Answer.Split(';');
foreach (var correctAnswer in correctAnswers)
{
userAnswers.Add(new UserAnswer{QuestionText = questionItem.Text, Answer = correctAnswer, Available = false, QuestionType = questionItem.Type});
}
}
return View(userAnswers);
}
а вот view:
@model List<Questionnaire.Models.UserAnswer>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Testing</title>
</head>
<body>
@using (Html.BeginForm()){
<ol>
@foreach (var item in Model)
{
@Html.CheckBoxFor(m => item.Available);
}
}
</ol>
<input type="submit" value="Check" />
}
</body>
</html>
UserAnswer
namespace Questionnaire.Models
{
public class UserAnswer
{
public string QuestionText { get; set; }
public string QuestionType{get; set;}
public string Answer { get; set; }
public bool Available { get; set; }
}
}