Ejemplo n.º 1
0
        //Takes the QuizList object and puts the values into the Model's List list
        void FillModel(SetQuizResponse setQuizResponse)
        {
            int counter = 0;

            QuizList list = setQuizResponse.attemptList;

            //prevents iteration over a null object
            if (!(setQuizResponse.quizIDs is null) || !(setQuizResponse.attemptList is null))
            {
                foreach (int quizID in list.quizIDs)
                {
                    //adds the quiz attempt
                    this.Model.QuizAttempts.Add(new Quizzes()
                    {
                        quizID = quizID, username = list.usernames[counter], quizContent = list.quizContents[counter], pointer = counter
                    });
                    counter += 1;
                }

                foreach (string quizID in setQuizResponse.quizIDs)
                {
                    this.Model.List.Add(quizID);
                }
            }
        }
Ejemplo n.º 2
0
        //Takes the QuizList object and puts the values into the Model's List list
        void FillModel(QuizList list)
        {
            //clears the list so it doesnt just append the new values on
            this.Model.List.Clear();

            int counter = 0;

            foreach (int quizID in list.quizIDs)
            {
                this.Model.List.Add(new Quizzes()
                {
                    quizID = quizID, quizName = list.quizNames[counter], quizType = list.quizType[counter], username = list.usernames[counter]
                });
                counter += 1;
            }
        }