@model ResponseQuestionnaireViewModel @{ ViewData["Title"] = "DisplayQuestionnaire"; Layout = "~/Views/Shared/_QuestionnaireResponse.cshtml"; }

@Model.Title

@Html.Raw(Model.Description)

@for (int i = 0; i < Model.Questions.Count; i++) { var question = Model.Questions[i]; string stepClass = i == 0 ? "active" : ""; // Adjusted the index to start from the first question
@((i + 1)). @question.Type
}
@for (int i = 0; i < Model.Questions.Count; i++) { var question = Model.Questions[i]; @for (int j = 0; j < question.Answers.Count; j++) { var answer = question.Answers[j]; }

@(i + 1). @question.Text

@switch (question.Type) { case QuestionType.Text: @foreach (var answer in question.Answers) { } break; case QuestionType.CheckBox: case QuestionType.Multiple_choice: case QuestionType.Demographic:
@foreach (var answer in question.Answers) {
}
break; case QuestionType.TrueFalse:
@foreach (var answer in question.Answers) {
}
break; case QuestionType.Open_ended: @foreach (var answer in question.Answers) { } break; case QuestionType.Slider: @foreach(var answer in question.Answers) { 50 } break; case QuestionType.Rating:
@foreach (var answer in question.Answers) {
@answer.Text
}
break; case QuestionType.Ranking:
    @foreach (var answer in question.Answers) {
  • @answer.Text
  • }
break; case QuestionType.Likert: @if (Model.Questions.Any(q => q.Type == QuestionType.Likert)) {
@foreach (var questions in Model.Questions.Where(q => q.Type == QuestionType.Likert)) {
@foreach (var answer in questions.Answers) { }
}
} break; case QuestionType.Matrix: @if (Model.Questions.Any(q => q.Type == QuestionType.Matrix)) // Check for Matrix type questions { @foreach (var matrixQuestion in Model.Questions.Where(q => q.Type == QuestionType.Matrix)) // Iterate through Matrix questions {
@foreach (var option in matrixQuestion.Answers) // Assuming these are the consistent answer options across all sub-questions { } @foreach (var option in matrixQuestion.Answers) // Use consistent options for each sub-question { }
Question@option.Text
@matrixQuestion.Text
} } break; case QuestionType.Image: @if (Model.Questions.Any(q => q.Type == QuestionType.Image)) { @foreach (var imageQuestion in Model.Questions.Where(q => q.Type == QuestionType.Image)) {
@foreach (var answer in imageQuestion.Answers) {
Image option
}
} } break; default: break; }
@if (i > 0) { } @if (i < Model.Questions.Count - 1) { }
}
@section Scripts { @{ } @* *@ }