コード例 #1
0
 public GameController(IQuizRepo quizRepo, IGameRepo gameRepo, IQuestionRepo questionRepo, UserManager <User> userMgr)
 {
     this.quizRepo     = quizRepo;
     this.gameRepo     = gameRepo;
     this.questionRepo = questionRepo;
     this.userMgr      = userMgr;
 }
コード例 #2
0
 public QuestionService(IQuestionRepo questionRepo, NotificationService notificationService, IAnswerRepo answerRepo, IQuestionHub questionHub)
 {
     this.questionRepo        = questionRepo;
     this.notificationService = notificationService;
     this.answerRepo          = answerRepo;
     this.questionHub         = questionHub;
 }
コード例 #3
0
 public QuestionController(IQuestionRepo questionRepo, IQuizRepo quizRepo, IAnswerRepo answerRepo, IChoiceRepo choiceRepo)
 {
     this.questionRepo = questionRepo;
     this.quizRepo     = quizRepo;
     this.answerRepo   = answerRepo;
     this.choiceRepo   = choiceRepo;
 }
コード例 #4
0
 public QuizController(UserManager <AppUser> userManager, IQuizRepo quizRepository, IQuestionRepo questionRepo, IAnswerRepo answerRepo)
 {
     this._userManager  = userManager;
     this._quizRepo     = quizRepository;
     this._questionRepo = questionRepo;
     this._answerRepo   = answerRepo;
 }
コード例 #5
0
 public QuestionService(
     IQuestionRepo questionRepo,
     ITestQuesRepo testQuesRepo
     )
 {
     _questionRepo = questionRepo;
     _testQuesRepo = testQuesRepo;
 }
コード例 #6
0
 public PlayController(IQuizRepo quizRepo, ApplicationDbContext context, IQuestionRepo questionRepo, IAnswerRepo answerRepo, IChoiceRepo choiceRepo)
 {
     this.quizRepo     = quizRepo;
     this.context      = context;
     this.questionRepo = questionRepo;
     this.answerRepo   = answerRepo;
     this.choiceRepo   = choiceRepo;
 }
コード例 #7
0
        public DataInitializer(IQuizRepo quizrepo, IQuestionRepo questionRepo, IAnswerRepo answerRepo, UserManager <AppUser> userMgr)
        {
            this._quizRepo     = quizrepo;
            this._questionRepo = questionRepo;
            this._answerRepo   = answerRepo;

            this._userMgr = userMgr;
        }
コード例 #8
0
 public ResponseService(
     IResponseRepo responseRepo,
     IQuestionRepo questionRepo
     )
 {
     _responseRepo = responseRepo;
     _questionRepo = questionRepo;
 }
コード例 #9
0
 public HomeController(ILogger <HomeController> logger, IQuizRepo quizRepo, IDifficultyRepo difficultyRepo, IQuestionRepo questionRepo, IAnswerRepo answerRepo)
 {
     _logger             = logger;
     this.quizRepo       = quizRepo;
     this.difficultyRepo = difficultyRepo;
     this.questionRepo   = questionRepo;
     this.answerRepo     = answerRepo;
 }
コード例 #10
0
 //constructor
 public DashboardController(IQuestionRepo questionRepo, IQuizRepo quizRepo, IAnswerRepo answerRepo, IChoiceRepo choiceRepo, ISubjectRepo subjectRepo)
 {
     this.questionRepo = questionRepo;
     this.quizRepo     = quizRepo;
     this.answerRepo   = answerRepo;
     this.choiceRepo   = choiceRepo;
     this.subjectRepo  = subjectRepo;
 }
コード例 #11
0
 public QuestionnaireManagerController(IQuestionnaireRepo questionnaireRepo,
                                       IQuestionRepo questionRepo,
                                       IAnswerRepo answerRepo,
                                       IPatientQuestionnaireRepo patientQuestionnaireRepo)
 {
     _questionnaireRepo        = questionnaireRepo;
     _questionRepo             = questionRepo;
     _answerRepo               = answerRepo;
     _patientQuestionnaireRepo = patientQuestionnaireRepo;
 }
コード例 #12
0
 public TestService(
     ITestRepo testRepo,
     IResponseRepo responseRepo,
     IQuestionRepo questionRepo,
     ITestQuesRepo testQuesRepo
     )
 {
     _testRepo     = testRepo;
     _responseRepo = responseRepo;
     _questionRepo = questionRepo;
     _testQuesRepo = testQuesRepo;
 }
コード例 #13
0
        public async static Task SeedQuizold(IQuizRepo quizRepo, IQuestionRepo questionRepo)
        {
            string[]         quizNames = { "Animals", "trivia", "geography" };
            List <QuizClass> quizzes   = new List <QuizClass>();

            foreach (var quizName in quizNames)
            {
                var quiz = await quizRepo.GetQuizByNameAsync(quizName);

                if (quiz == null)
                {
                    QuizClass newQuiz = new QuizClass()
                    {
                        Name        = quizName,
                        Difficulty  = 2,
                        Description = "A quiz about " + quizName
                    };
                    await quizRepo.Create(newQuiz);
                }
                quizzes.Add(quiz);
            }

            Question vraag1 = new Question()
            {
                Description = "hoeveel weegt pikachu"
            };
            Option option1 = new Option()
            {
                OptionDescription = "5 kg",
                CorrectAnswer     = true
            };
            Option option2 = new Option()
            {
                OptionDescription = "8 kg",
                CorrectAnswer     = false
            };

            List <Option> opties = new List <Option>();

            opties.Add(option1);
            opties.Add(option2);
            vraag1.PossibleOptions = opties;

            var question = await questionRepo.GetQuestionByDescriptionAsync(vraag1.Description);

            if (question == null)
            {
                await questionRepo.Create(vraag1);
            }
            await quizRepo.AddQuestionToQuizAsync(quizzes[0].QuizId, vraag1.QuestionId);
        }
 public PatientQuestionnaireController(IQuestionnaireRepo questionnaireRepo,
                                       IQuestionRepo questionRepo,
                                       IAnswerRepo answerRepo,
                                       IUserAnswerRepo userAnswerRepo,
                                       IUserQuestionnaireAnswerRepo userQuestionnaireAnswerRepo,
                                       IPatientQuestionnaireRepo patientQuestionnaireRepo)
 {
     _questionnaireRepo           = questionnaireRepo;
     _questionRepo                = questionRepo;
     _answerRepo                  = answerRepo;
     _userAnswerRepo              = userAnswerRepo;
     _userQuestionnaireAnswerRepo = userQuestionnaireAnswerRepo;
     _patientQuestionnaireRepo    = patientQuestionnaireRepo;
 }
コード例 #15
0
 public QuestionnaireResultsController(IQuestionnaireRepo questionnaireRepo,
                                       IQuestionRepo questionRepo,
                                       IUserRepo userRepo,
                                       IPatientQuestionnaireRepo patientQuestionnaireRepo,
                                       UserManager <User> userManager,
                                       IUserAnswerRepo userAnswerRepo,
                                       IUserQuestionnaireAnswerRepo userQuestionnaireAnswerRepo)
 {
     _questionnaireRepo           = questionnaireRepo;
     _questionRepo                = questionRepo;
     _userRepo                    = userRepo;
     _patientQuestionnaireRepo    = patientQuestionnaireRepo;
     _userManager                 = userManager;
     _userAnswerRepo              = userAnswerRepo;
     _userQuestionnaireAnswerRepo = userQuestionnaireAnswerRepo;
 }
コード例 #16
0
 public QuizOverviewController(IQuizRepo quizRepo, IQuestionRepo questionRepo)
 {
     this.quizRepo     = quizRepo;
     this.questionRepo = questionRepo;
 }
コード例 #17
0
 public QuestionController()
 {
     repo = new QuestionRepo();
 }
コード例 #18
0
 public QuestionService(IQuestionRepo dataRepository)
 {
     _dataRepository = dataRepository;
 }
コード例 #19
0
 public QuestionController(IQuestionRepo repo, IMapper mapper, ILogger <QuestionController> logger) : base(repo, mapper, logger)
 {
     this._repo   = repo;
     this._mapper = mapper;
     this._logger = logger;
 }
コード例 #20
0
 public QuestionService(IQuestionRepo questionRepo, IQuestionOrderService questionOrderService)
 {
     this.questionRepo         = questionRepo;
     this.questionOrderService = questionOrderService;
 }
コード例 #21
0
ファイル: Game.cs プロジェクト: DavidDuttywood/KanaPractice
 public Game(IQuestionRepo questionRepo, IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
     _questionRepo        = questionRepo;
 }
コード例 #22
0
        public async static Task SeedQuiz(IQuizRepo quizRepo, IQuestionRepo questionRepo)
        {
            //quiz over Trivia aanmaken
            string quizName = "Trivia";

            if (await quizRepo.GetQuizByNameAsync(quizName) == null)
            {
                QuizClass newQuiz = new QuizClass()
                {
                    Name        = quizName,
                    Difficulty  = 5,
                    Description = "A quiz about all sorts of things"
                };
                await quizRepo.Create(newQuiz);

                List <Option> opties = new List <Option>();
                Question      vraag  = new Question()
                {
                    Description = "Which of the following items was owned by the fewest U.S. homes in 1990?"
                };
                if (await questionRepo.GetQuestionByDescriptionAsync(vraag.Description) == null)
                {
                    Option option1 = new Option()
                    {
                        OptionDescription = "home computer",
                        CorrectAnswer     = false
                    };
                    Option option2 = new Option()
                    {
                        OptionDescription = "compact disk player",
                        CorrectAnswer     = true
                    };
                    Option option3 = new Option()
                    {
                        OptionDescription = "dishwasher",
                        CorrectAnswer     = false
                    };
                    opties.Add(option1);
                    opties.Add(option2);
                    opties.Add(option3);
                    vraag.PossibleOptions = opties;
                    await questionRepo.Create(vraag);

                    await quizRepo.AddQuestionToQuizAsync(newQuiz.QuizId, vraag.QuestionId);
                }

                vraag = new Question()
                {
                    Description = "How tall is the tallest man on earth?"
                };
                if (await questionRepo.GetQuestionByDescriptionAsync(vraag.Description) == null)
                {
                    Option option1 = new Option()
                    {
                        OptionDescription = "2.72 m",
                        CorrectAnswer     = true
                    };
                    Option option2 = new Option()
                    {
                        OptionDescription = "2.64 m",
                        CorrectAnswer     = false
                    };
                    Option option3 = new Option()
                    {
                        OptionDescription = "3.05 m",
                        CorrectAnswer     = false
                    };
                    opties = new List <Option>();
                    opties.Add(option1);
                    opties.Add(option2);
                    opties.Add(option3);
                    vraag.PossibleOptions = opties;
                    await questionRepo.Create(vraag);

                    await quizRepo.AddQuestionToQuizAsync(newQuiz.QuizId, vraag.QuestionId);
                }
                vraag = new Question()
                {
                    Description = "Which racer holds the record for the most Grand Prix wins?"
                };
                if (await questionRepo.GetQuestionByDescriptionAsync(vraag.Description) == null)
                {
                    Option option1 = new Option()
                    {
                        OptionDescription = "Michael Schumacher",
                        CorrectAnswer     = true
                    };
                    Option option2 = new Option()
                    {
                        OptionDescription = "Mario Andretti",
                        CorrectAnswer     = false
                    };
                    Option option3 = new Option()
                    {
                        OptionDescription = "Lewis Hamilton",
                        CorrectAnswer     = false
                    };
                    opties = new List <Option>();
                    opties.Add(option1);
                    opties.Add(option2);
                    opties.Add(option3);
                    vraag.PossibleOptions = opties;
                    await questionRepo.Create(vraag);

                    await quizRepo.AddQuestionToQuizAsync(newQuiz.QuizId, vraag.QuestionId);
                }
            }
            return;
        }
コード例 #23
0
 public Mapper(IQuestionRepo questionRepo)
 {
     this.questionRepo = questionRepo;
 }
コード例 #24
0
 public QuizRepo(QuizDbContext context, IQuestionRepo questionRepo)
 {
     this.context      = context;
     this.questionRepo = questionRepo;
 }
コード例 #25
0
 // Constructor
 public QuizController(IQuestionRepo questionRepository)
 {
     _questionRepository = questionRepository;
 }
コード例 #26
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IQuizRepo quizRepo, IQuestionRepo questionRepo, QuizDbContext context, RoleManager <Role> roleMgr, UserManager <User> userMgr)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseStatusCodePagesWithRedirects("/Error/{0}");
            }
            else
            {
                app.UseStatusCodePagesWithRedirects("/Error/{0}");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            QuizDbContextExtensions.SeedQuiz(quizRepo, questionRepo).Wait();
            QuizDbContextExtensions.SeedRoles(roleMgr).Wait();
            QuizDbContextExtensions.SeedUsers(userMgr).Wait();
        }
コード例 #27
0
ファイル: QuestionService.cs プロジェクト: Viktor5528/Quiz
 public QuestionService(IMapper mapper, IQuestionRepo repo)
 {
     _repo   = repo;
     _mapper = mapper;
 }
コード例 #28
0
 public QuestionController(IQuestionRepo questionRepo)
 {
     _questionRepo = questionRepo;
 }
コード例 #29
0
 public QuizController(IQuizRepo repo, IQuestionRepo qRepo, ApplicationDbContext ctx)
 {
     repository   = repo;
     questionRepo = qRepo;
     _context     = ctx;
 }
コード例 #30
0
 public QuizService(IMapper mapper, IQuizRepo repo, IQuestionRepo questionRepo)
 {
     _mapper       = mapper;
     _quizRepo     = repo;
     _questionRepo = questionRepo;
 }