public QuizzesController(QuizContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public GradesController(QuizContext context) { _context = context; }
public CategoriesController(QuizContext context) { _context = context; }
public QuizDetailController(QuizContext context) { _context = context; }
public QuestionsController(QuizContext context) { this.context = context; }
public EfUnitOfWork() { _db = new QuizContext(); }
public HomeController(/*Microsoft.AspNetCore.Identity.UserManager<IdentityUser> userManager,*/ QuizContext db) { this.db = db; }
public ScoresController(QuizContext context, UserManager <User> _userManager) { _context = context; userManager = _userManager; }
// ReSharper disable once UnusedMember.Global public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, QuizContext context) { context.Database.Migrate(); loggerFactory.AddConsole(LogLevel.Information); //if (env.IsDevelopment()) //{ app.UseDeveloperExceptionPage(); //} app.UseStaticFiles(); if (env.IsDevelopment() == false) { //Enforce HTTPS //Enable App Insights //Enable custom error pages } //app.UseCookieAuthentication(); //app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions //{ // ClientId = Configuration["AzureAd:ClientId"], // Authority = Configuration["AzureAd:Authority"], // CallbackPath = Configuration["AzureAd:CallbackPath"], // TokenValidationParameters = new TokenValidationParameters() // { // ValidateIssuer = false // } //}); app.UseJwtBearerAuthentication(new JwtBearerOptions { AutomaticAuthenticate = true, AutomaticChallenge = true, Authority = Configuration["AzureAd:Authority"], Audience = Configuration["AzureAd:Audience"], TokenValidationParameters = new TokenValidationParameters() { ValidateIssuer = false } }); app.UseSession(); app.UseSignalR(); app.UseMvc(routes => { routes.MapRoute("default", "{*url}", new { controller = "Home", action = "Index" }); }); //app.UseWebSockets(); }
public QuizUsersController(QuizContext context) { _context = context; }
public ContestantsApiKeyAuthAttribute(QuizContext context) { this.quizContext = context; }
public QuestionController(QuizContext context) { _context = context; }
public TakeQuizModel(QuizContext context, ISessionHelper sessionHelper) { db = context; this.sessionHelper = sessionHelper; }
public SessionsController(QuizContext context) { _context = context; }
public TestService(QuizContext context) { _context = context; }
public QuizRepository(QuizContext quizContext) { this.quizContext = quizContext; }
public AttemptFilterView Filter(QuizContext cx, ApplicationUser user) { CurrentUser = user; var users = new HashSet <ApplicationUser>(); foreach (var group in cx.Groups.Where(x => x.Creator.Id == user.Id).ToList()) { foreach (var applicationUser in group.ApplicationUsers) { users.Add(applicationUser); } } var userIds = users.Select(x => x.Id).ToList(); var filteringData = cx.QuizAttempts. Where(x => x.User.Id == user.Id || userIds.Contains(user.Id) || x.Quiz.User.Id == user.Id).ToList(); filteringData = filteringData. Where(x => _Filter(x)). ToList(); int pagesCount = 0; int lastPagePushSize = filteringData.Count % PageSize; //last has all size OR Count == 0 if (lastPagePushSize == 0) { pagesCount = filteringData.Count / PageSize; //Count == 0 if (pagesCount == 0) { pagesCount = 1; } else { lastPagePushSize = PageSize; } } else { pagesCount = filteringData.Count / PageSize + 1; } if (Page > pagesCount) { //bag Page = 1; } var data = filteringData.GetRange((Page - 1) * PageSize, Page == pagesCount ? lastPagePushSize : PageSize); //quizzes - my + which i passed var attempts = cx.QuizAttempts.Where(x => x.User.Id == CurrentUser.Id).ToList(); var quizIds = attempts.Select(x => x.Quiz.Id).ToList(); //groups - my + opened!!!!!!!!!!!!!!!!!!!!!!!!!!! var openedIds = user.Groups.Select(x => x.Id).ToList(); var result = new AttemptFilterView() { Filters = this, Data = data, Quizzes = cx.Quizzes.Where(x => x.User.Id == user.Id || quizIds.Contains(x.Id)).ToList(), Groups = cx.Groups.Where(x => x.Creator.Id == user.Id || openedIds.Contains(x.Id)), Users = users, PagesCount = pagesCount }; return(result); }
public TopicsRepository(QuizContext quizContext) { _context = quizContext ?? throw new ArgumentNullException(nameof(quizContext)); }
protected DataService(QuizContext context) { _context = context; }
public UserRepository() { db = new QuizContext(); }
public HomeController(QuizContext context) { db = context; }
public static ExamViewModal CalculateResultData(ExamViewModal examViewModal) { int correctAnswercount = 0; int WrongAnswerCount = 0; int NoAnswerCount = 0; foreach (QuestionViewModel qvmodel in examViewModal.QuestionSheet) { var question = QuizAPI.Repository.QuestionRepository.GetQuestion(qvmodel.QuestionId); qvmodel.CorrectAnswer = question.CorrectAnswerIndex; int knowledgeareaid = question.KnowledgeAreaId; if (qvmodel.UserAnswer.Trim() == "") { qvmodel.isCorrect = "S"; NoAnswerCount++; } else { if (qvmodel.UserAnswer.Trim() == qvmodel.CorrectAnswer.Trim()) { qvmodel.isCorrect = "Y"; correctAnswercount++; } else { qvmodel.isCorrect = "N"; WrongAnswerCount++; } } var asd = from cnt in examViewModal.ExamKnowledgeViewModals where cnt.KnowledgeAreaID == knowledgeareaid select cnt; foreach (var element in asd) { if (qvmodel.isCorrect == "Y") { element.CorrectAnswerCount = element.CorrectAnswerCount + 1; } else if (qvmodel.isCorrect == "S") { element.NoAnswerCount = element.NoAnswerCount + 1; } else if (qvmodel.isCorrect == "N") { element.WrongAnswersCount = element.WrongAnswersCount + 1; } } } examViewModal.correctAnswercount = correctAnswercount; examViewModal.WrongAnswerCount = WrongAnswerCount; examViewModal.NoAnswerCount = NoAnswerCount; examViewModal.TotalMark = correctAnswercount * examViewModal.MarkPerQstn; examViewModal.Negativemark = WrongAnswerCount * examViewModal.NegativemarkPerQstn; examViewModal.FinalMark = examViewModal.TotalMark - examViewModal.Negativemark; using (QuizContext cntxt = new QuizContext()) { CandidateResult canreslt = new CandidateResult(); canreslt.CandidateId = examViewModal.Candidateviewmodal.CandidateId; canreslt.ExamTableMainId = examViewModal.ExamTableMainId; canreslt.correctAnswercount = examViewModal.correctAnswercount; canreslt.WrongAnswerCount = examViewModal.WrongAnswerCount; canreslt.NoAnswerCount = examViewModal.NoAnswerCount; canreslt.UsedMinutes = examViewModal.UsedMinutes; canreslt.TotalQuestion = examViewModal.TotalQuestion; canreslt.TotalMark = examViewModal.TotalMark; canreslt.Negativemark = examViewModal.Negativemark; canreslt.FinalMark = examViewModal.FinalMark; canreslt.ExamDate = DateTime.Now; cntxt.CandidateResults.Add(canreslt); cntxt.SaveChanges(); foreach (ExamKnowledgeViewModal knwmdl in examViewModal.ExamKnowledgeViewModals) { CandidateResultDetail canresltdet = new CandidateResultDetail(); canresltdet.CandidateResultId = canreslt.CandidateResultId; canresltdet.KnowledgeAreaID = knwmdl.KnowledgeAreaID; canresltdet.TotalQstn = knwmdl.TotalQstn; canresltdet.WrongAnswersCount = knwmdl.WrongAnswersCount; canresltdet.NoAnswerCount = knwmdl.NoAnswerCount; canresltdet.CorrectAnswerCount = knwmdl.CorrectAnswerCount; cntxt.CandidateResultDetails.Add(canresltdet); cntxt.SaveChanges(); } } return(examViewModal); }
public QuizzesController(QuizContext context) { _context = context; }
private async void cntnBtn_Clicked(object sender, EventArgs e) { if (!rightOption.IsChecked && !wrongOption1.IsChecked && !wrongOption2.IsChecked && !wrongOption3.IsChecked) { uint timeout = 50; await cntnBtn.TranslateTo(-15, 0, timeout); await cntnBtn.TranslateTo(15, 0, timeout); await cntnBtn.TranslateTo(-10, 0, timeout); await cntnBtn.TranslateTo(10, 0, timeout); await cntnBtn.TranslateTo(-5, 0, timeout); await cntnBtn.TranslateTo(5, 0, timeout); cntnBtn.TranslationX = 0; } else if (rightOption.IsChecked) { cntnBtn.IsEnabled = false; Color color = Color.FromHex("#5DFC0A"); cntnBtn.Text = "Correct!"; cntnBtn.BackgroundColor = color; AudioService audio = new AudioService(); audio.PlayAudioFile("correct.mp3"); App.counter++; using (QuizContext context = new QuizContext()) { var button = context.Buttons.First(a => a.Id == 2); button.Passed = true; button.DoneBefore = true; context.SaveChanges(); } await Task.Delay(1300); await Navigation.PushModalAsync(new State.IntroPassed()); } else { using (QuizContext context = new QuizContext()) { var button = context.Buttons.First(a => a.Id == 2); button.Passed = false; context.SaveChanges(); } cntnBtn.IsEnabled = false; Color color = Color.FromHex("#FF0000"); cntnBtn.Text = "Wrong!"; cntnBtn.BackgroundColor = color; AudioService audio = new AudioService(); audio.PlayAudioFile("wrong.mp3"); await Task.Delay(1300); await Navigation.PushModalAsync(new State.IntroFailed()); } }
public Handler(QuizContext context) { this.context = context; }
/// <summary> /// Class constructor /// </summary> /// <param name="context"></param> public QuestionsController(QuizContext context) { //Sets the context this.context = context; }
public TestRepository(QuizContext context) { _db = context; }
public QuizService(QuizContext context) { this._quizContext = context; }
public QuestionsController(QuizContext quizContext, ILogger <QuestionsController> logger) { _logger = logger; _quizContext = quizContext; }
public QuestionController(QuizContext context, UserManager <User> user) { quizContext = context; userManager = user; }