Ejemplo n.º 1
0
        public static void Seed(QuizContext context)
        {
            var quiz = new Quiz() { Name = "C# Beginer Quiz" };
            context.Quiz.Add(quiz);
            context.SaveChanges();

            var quizQuestion = new List<QuizQuestion>
                {
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 1 : int keyword targets to which .Net type?", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 2 : What is the output of the code public class B : A { } ", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 3 : Which of the following statements correctly define .NET Framework?", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 4 : A class that cannot be inherited is what type of class?", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 5 : How can we sort the elements of the array in descending order?", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 6 : Features of Read only variables", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 7 : What is the difference between Convert.ToString(str) and str.ToString() method?", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 8 : Managed methods will be marked as _________ in MSIL code", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 9 : Which of the following in not service model (three-tier application) in c sharp?", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                    new QuizQuestion{ Quiz = quiz, Text = "Ques 10 : An Event has _____ as default return type", TaskType = QuizQuestion.QuizQuestionType.OneOfMany},
                };
            quizQuestion.ForEach(s => context.QuizQuestion.Add(s));
            context.SaveChanges();

            var options = new List<QuizOption>
                {
                new QuizOption{ QuizQuestion = quizQuestion[0], IsCorrectAnswer = false, Text = "System.Int8"},
                new QuizOption{ QuizQuestion = quizQuestion[0], IsCorrectAnswer = true, Text = "System.Int16"},
                new QuizOption{ QuizQuestion = quizQuestion[0], IsCorrectAnswer = false, Text = "System.Int32"},
                new QuizOption{ QuizQuestion = quizQuestion[0], IsCorrectAnswer = false, Text = "System.Int64"},

                new QuizOption{ QuizQuestion = quizQuestion[1], IsCorrectAnswer = false, Text = "It defines a class that inherits the public methods of A only."},
                new QuizOption{ QuizQuestion = quizQuestion[1], IsCorrectAnswer = true, Text = "It defines a class that inherits all the methods of A but the private members cannot be accessed."},
                new QuizOption{ QuizQuestion = quizQuestion[1], IsCorrectAnswer = false, Text = "Errors."},
                new QuizOption{ QuizQuestion = quizQuestion[1], IsCorrectAnswer = false, Text = "A and B."},

                new QuizOption{ QuizQuestion = quizQuestion[2], IsCorrectAnswer = true, Text = "It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services."},
                new QuizOption{ QuizQuestion = quizQuestion[2], IsCorrectAnswer = false, Text = "It is an environment for developing, building, deploying and executing Distributed Applications."},
                new QuizOption{ QuizQuestion = quizQuestion[2], IsCorrectAnswer = false, Text = "It is an environment for development and execution of Windows applications."},
                new QuizOption{ QuizQuestion = quizQuestion[2], IsCorrectAnswer = false, Text = "It is an environment for developing, building, deploying and executing only Web Applications."},

                new QuizOption{ QuizQuestion = quizQuestion[3], IsCorrectAnswer = true, Text = "Sealed"},
                new QuizOption{ QuizQuestion = quizQuestion[3], IsCorrectAnswer = false, Text = "Gather"},
                new QuizOption{ QuizQuestion = quizQuestion[3], IsCorrectAnswer = false, Text = "Static"},
                new QuizOption{ QuizQuestion = quizQuestion[3], IsCorrectAnswer = false, Text = "Constru"},

                new QuizOption{ QuizQuestion = quizQuestion[4], IsCorrectAnswer = false, Text = "By calling Sortdescending() method"},
                new QuizOption{ QuizQuestion = quizQuestion[4], IsCorrectAnswer = false, Text = "By calling Sort() method"},
                new QuizOption{ QuizQuestion = quizQuestion[4], IsCorrectAnswer = true, Text = "By calling Sort() and then Reverse() methods"},
                new QuizOption{ QuizQuestion = quizQuestion[4], IsCorrectAnswer = false, Text = "By calling Sortreverse() method"},

                new QuizOption{ QuizQuestion = quizQuestion[5], IsCorrectAnswer = false, Text = "Declaration and initialization is separated"},
                new QuizOption{ QuizQuestion = quizQuestion[5], IsCorrectAnswer = false, Text = "It is allocated at compile time"},
                new QuizOption{ QuizQuestion = quizQuestion[5], IsCorrectAnswer = false, Text = "It is allocated at runtime"},
                new QuizOption{ QuizQuestion = quizQuestion[5], IsCorrectAnswer = true, Text = "All of the above"},

                new QuizOption{ QuizQuestion = quizQuestion[6], IsCorrectAnswer = true, Text = "Convert.ToString(str) function handles NULL while str.ToString() does not. It will throw a NULL reference exception."},
                new QuizOption{ QuizQuestion = quizQuestion[6], IsCorrectAnswer = false, Text = "str.ToString() function handles NULL while Convert.ToString(str) does not. It will throw a NULL reference exception."},
                new QuizOption{ QuizQuestion = quizQuestion[6], IsCorrectAnswer = false, Text = "Both can handle NULL"},
                new QuizOption{ QuizQuestion = quizQuestion[6], IsCorrectAnswer = false, Text = "None can Handle NULL"},

                new QuizOption{ QuizQuestion = quizQuestion[7], IsCorrectAnswer = false, Text = "mscorjit"},
                new QuizOption{ QuizQuestion = quizQuestion[7], IsCorrectAnswer = true, Text = "cil"},
                new QuizOption{ QuizQuestion = quizQuestion[7], IsCorrectAnswer = false, Text = "dgclr"},
                new QuizOption{ QuizQuestion = quizQuestion[7], IsCorrectAnswer = false, Text = "None"},

                new QuizOption{ QuizQuestion = quizQuestion[8], IsCorrectAnswer = false, Text = "Presentation (UI)"},
                new QuizOption{ QuizQuestion = quizQuestion[8], IsCorrectAnswer = false, Text = "Business (logic and underlying code)"},
                new QuizOption{ QuizQuestion = quizQuestion[8], IsCorrectAnswer = true, Text = "Database (for storing the data)"},
                new QuizOption{ QuizQuestion = quizQuestion[8], IsCorrectAnswer = false, Text = "Data (from storage or other sources)"},

                new QuizOption{ QuizQuestion = quizQuestion[9], IsCorrectAnswer = true, Text = "No return type for events"},
                new QuizOption{ QuizQuestion = quizQuestion[9], IsCorrectAnswer = false, Text = "String"},
                new QuizOption{ QuizQuestion = quizQuestion[9], IsCorrectAnswer = false, Text = "Double"},
                new QuizOption{ QuizQuestion = quizQuestion[9], IsCorrectAnswer = false, Text = "Integer"},
                };
            options.ForEach(s => context.QuizOption.Add(s));
            context.SaveChanges();
        }
Ejemplo n.º 2
0
 public StatsRepository(Int32 userID, Int32 quizID, Quiz currentQuiz)
 {
     _userID = userID;
     _quizID = quizID;
     _currentQuiz = currentQuiz;
 }