public QuestionController(IQuestionRepo questionRepo, IQuizRepo quizRepo, IAnswerRepo answerRepo, IChoiceRepo choiceRepo) { this.questionRepo = questionRepo; this.quizRepo = quizRepo; this.answerRepo = answerRepo; this.choiceRepo = choiceRepo; }
public static Quiz_DTO ConvertQuizTo_DTO(Quiz quiz, ref Quiz_DTO quiz_DTO, IQuizRepo quizRepo) { quiz_DTO.Id = quiz.Id; quiz_DTO.DifficultyId = quiz.DifficultyId; quiz_DTO.Subject = quiz.Subject; quiz_DTO.Description = quiz.Description; var diff = new Difficulty_DTO(); quiz_DTO.Difficulty = ConvertDifficultyTo_DTO(quiz.Difficulty, ref diff); List <Question_DTO> question_DTOs = new List <Question_DTO>(); //Questions foreach (Question question in quiz.Questions) { var obj = new Question_DTO(); question_DTOs.Add(ConvertQuestionTo_DTO(question, obj, quizRepo).Result); } quiz_DTO.Questions = question_DTOs; List <Result_DTO> result_DTOs = new List <Result_DTO>(); //results foreach (Result result in quiz.Results) { var obj = new Result_DTO(); result_DTOs.Add(ConvertResultTo_DTO(result, ref obj)); } quiz_DTO.Results = result_DTOs; return(quiz_DTO); }
public QuizController(IQuizRepo quizrepo, ProjectDBContext context, UserManager <Person> UserMgr, IQuestionsRepo questionsRepo) { this.quizrepo = quizrepo; this.context = context; _userManager = UserMgr; this.questionsRepo = questionsRepo; }
public QuestionsController(IQuestionsRepo questionsRepo, ProjectDBContext context, IQuizRepo quizrepo, IHistoryRepo historyRepo) { this.questionsRepo = questionsRepo; this.context = context; this.quizrepo = quizrepo; this.historyRepo = historyRepo; }
// 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(); }
public GameController(IQuizRepo quizRepo, IGameRepo gameRepo, IQuestionRepo questionRepo, UserManager <User> userMgr) { this.quizRepo = quizRepo; this.gameRepo = gameRepo; this.questionRepo = questionRepo; this.userMgr = userMgr; }
public AnswersController(IQuestionsRepo questionsRepo, ProjectDBContext context, IQuizRepo quizrepo, IAnswersRepo answerRepo) { this.questionsRepo = questionsRepo; this.context = context; this.quizrepo = quizrepo; this.answerRepo = answerRepo; }
public QuizController(UserManager <AppUser> userManager, IQuizRepo quizRepository, IQuestionRepo questionRepo, IAnswerRepo answerRepo) { this._userManager = userManager; this._quizRepo = quizRepository; this._questionRepo = questionRepo; this._answerRepo = answerRepo; }
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; }
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; }
public PlayController(IQuizRepo quizRepo, ISubjectRepo subjectRepo, IUserQuizRepo userQuizRepo, IQuizAnswerRepo quizAnswerRepo, IAnswerRepo answerRepo) { this.quizRepo = quizRepo; this.subjectRepo = subjectRepo; this.userQuizRepo = userQuizRepo; this.quizAnswerRepo = quizAnswerRepo; this.answerRepo = answerRepo; }
public DataInitializer(IQuizRepo quizrepo, IQuestionRepo questionRepo, IAnswerRepo answerRepo, UserManager <AppUser> userMgr) { this._quizRepo = quizrepo; this._questionRepo = questionRepo; this._answerRepo = answerRepo; this._userMgr = userMgr; }
//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; }
public QuizController(IQuizRepo quizRepo, UserManager <Gebruiker> userManager, IQuizGebruikerRepo quizGebruikerRepo, IQuizService quizService, IMoeilijkheidsgraadRepo moeilijkheidsGraadRepo, ILogger <QuizController> logger) { _userManager = userManager; this.quizGebruikerRepo = quizGebruikerRepo; this.quizService = quizService; this.moeilijkheidsGraadRepo = moeilijkheidsGraadRepo; this.logger = logger; this.quizRepo = quizRepo; }
public QuizController(IQuizRepo quizRepo, IChoiceRepo choiceRepo, IQuizService quizService, IUserQuizRepo userQuizRepo, IDifficultyRepo difficultyRepo, ILogger <QuizController> logger) { _quizRepo = quizRepo; _choiceRepo = choiceRepo; _quizService = quizService; _userQuizRepo = userQuizRepo; _difficultyRepo = difficultyRepo; _logger = logger; }
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 async static Task <Question_DTO> ConvertQuestionTo_DTO(Question question, Question_DTO question_DTO, IQuizRepo quizRepo) { question_DTO.Id = question.Id; question_DTO.Description = question.Description; var result = await quizRepo.GetAllAnswersByQuestionId(question.Id); List <Answer_DTO> answer_DTOs = new List <Answer_DTO>(); //Answers foreach (Answer answer in result) { var obj = new Answer_DTO(); answer_DTOs.Add(ConvertAnswerTo_DTO(answer, ref obj)); } question_DTO.Answers = answer_DTOs; return(question_DTO); }
public QuizController(IQuizRepo quizRepo, ISubjectRepo subjectRepo) { this.quizRepo = quizRepo; this.subjectRepo = subjectRepo; }
public HomeController(ILogger <HomeController> logger, IQuizRepo quizRepo) { _logger = logger; this.quizRepo = quizRepo; }
public QuizAPIController(IQuizRepo quizRepo, IGameRepo gameRepo, UserManager <User> userMgr) { this.quizRepo = quizRepo; this.gameRepo = gameRepo; this.userMgr = userMgr; }
public DevDbContextExtensions(IQuizRepo quizRepo) { this._quizRepo = quizRepo; }
public QuizController(IQuizRepo quizRepo) { this.quizRepo = quizRepo; }
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; }
public QuizController(IQuizRepo repo, IQuestionRepo qRepo, ApplicationDbContext ctx) { repository = repo; questionRepo = qRepo; _context = ctx; }
public QAndAController(IQuizRepo quizRepo, ILogger <QAndAController> logger) { this.quizRepo = quizRepo; this.logger = logger; }
public QuizOverviewController(IQuizRepo quizRepo, IQuestionRepo questionRepo) { this.quizRepo = quizRepo; this.questionRepo = questionRepo; }
public AdminController(IQuizRepo quizRepo, UserManager <Person> userManager, IHostingEnvironment hostingEnvironment) { this.quizRepo = quizRepo; this.userManager = userManager; this.hostingEnvironment = hostingEnvironment; }
public QuizController(IQuizRepo repo, IMapper mapper, ILogger <QuizController> logger) : base(repo, mapper, logger) { this._repo = repo; this._mapper = mapper; this._logger = logger; }
public QuizService(IQuizRepo quizRepo) { this.quizRepo = quizRepo; }
public QuizController(IQuizRepo quizRepo, UserManager <Person> userManager) { this.quizRepo = quizRepo; this.userManager = userManager; }