Ejemplo n.º 1
0
        public static Question createByJToken(JToken data)
        {
            Question question = new Question() {
                Id = Convert.ToInt32(data["id"]),
                Text = data["text"].ToString(),
                CorectAnswerId = Convert.ToInt32(data["corectAnswerId"])
            };
            question.Answers = Answer.createByJToken(data["answers"], question);

            return question;
        }
Ejemplo n.º 2
0
        //[ManyToOne(CascadeOperations = CascadeOperation.CascadeRead)]
        //public Question Question { get; set; }
        public static List<Answer> createByJToken(JToken data, Question question)
        {
            List<Answer> answers = new List<Answer>();
            foreach (var answer in data)
                answers.Add(new Answer() {
                    Id = Convert.ToInt32(answer["id"]),
                    Text = answer["text"].ToString(),
                    QuestionId = question.Id,
                   // Question = question
                });

            return answers;
        }
Ejemplo n.º 3
0
        public Question getQuestion()
        {
            List<Answer> answers = new List<Answer>();
            answers.Add(getCorrectAnswer());
            answers.Add(new Answer() { Id = 2, Text = "a2" });
            answers.Add(new Answer() { Id = 3, Text = "a3" });

            foreach (Answer answer in answers)
                answer.QuestionId = 1;

            Question question = new Question()
            {
                Id = 1,
                Text = "Text",
                CorectAnswerId = 1,
                Answers = answers
            };

            return question;
        }
Ejemplo n.º 4
0
 public QuizeItemControl(Question _question, EventHandler _clickNext)
 {
     InitializeComponent();
     LayoutRoot.DataContext = question = _question;
     clickNext = _clickNext;
 }