Example #1
0
        public static HtmlString ChoiceAcceptable(this HtmlHelper htmlHelper, QuestionAnswerModel qa, Dictionary<short, Answer> compare)
        {
            var html = "";
            var compareAnswer = GetMutualAnswer(qa.Question.Id, compare);

            for (int i = 0; i < qa.Question.Choices.Count; i++)
            {
                var tag = new TagBuilder("span");

                AcceptableChoice(tag, i + 1, qa.Answer.ChoiceAccept);

                if (compareAnswer != null)
                {
                    //we both answered this question - add comparison classes
                    if (compareAnswer.ChoiceIndex == i + 1) MatchChoice(tag, i + 1, qa.Answer.ChoiceAccept);
                }

                tag.InnerHtml = qa.Question.Choices[i];
                html += "<li>" + tag.ToString() + "</li>";
            }

            return new HtmlString(html);
        }
Example #2
0
        public static HtmlString Choices(this HtmlHelper htmlHelper, QuestionAnswerModel qa, Dictionary<short, Answer> compare, bool isFirstPart)
        {
            var html = "";
            var compareAnswer = GetMutualAnswer(qa.Question.Id, compare);

            for (int i = 0; i < qa.Question.Choices.Count; i++)
            {
                var tag = new TagBuilder("span");

                if (isFirstPart)
                {
                    ChoicePart1(tag, qa.Answer, compareAnswer, i + 1);
                }
                else
                {
                    ChoicePart2(tag, qa.Answer, compareAnswer, i + 1);
                }

                tag.InnerHtml = qa.Question.Choices[i];
                html += "<li>" + tag.ToString() + "</li>";
            }

            return new HtmlString(html);
        }