public ActionResult Edit(KnowledgeTest knowledgeTest) { try { _knowledgeTestService.Update(new KnowledgeTest { Question = knowledgeTest.Question, Answer1 = knowledgeTest.Answer1, Answer2 = knowledgeTest.Answer2, Answer3 = knowledgeTest.Answer3, Answer4 = knowledgeTest.Answer4, KnowledgeDate = DateTime.Now, Point = knowledgeTest.Point, IsActive = knowledgeTest.IsActive, ValidAnswerType = knowledgeTest.ValidAnswerType, KnowledgeTestId = knowledgeTest.KnowledgeTestId }); SuccessNotification("Kayıt Güncellendi"); return(RedirectToAction("KnowledgeTestIndex")); } catch { return(View()); } }
public IActionResult Upsert(int?id) { KnowledgeTest = new KnowledgeTest(); if (id == null) { return(View(KnowledgeTest)); } KnowledgeTest = _db.KnowledgeTests.FirstOrDefault(u => u.Id == id); if (KnowledgeTest == null) { return(NotFound()); } return(View(KnowledgeTest)); }
public KnowledgeTestResultModel GetResult(KnowledgeTest test) { var result = new KnowledgeTestResultModel { Name = test.TestTemplate.Name, CorrectAnswers = test.Questions.Count(x => x.IsProvidedCorrectAnswer), IncorrectAnswers = test.Questions.Count(x => !x.IsProvidedCorrectAnswer), SubmittedAt = test.ModifiedAt, }; result.Result = Math.Round((result.CorrectAnswers * 100d) / (result.CorrectAnswers + result.IncorrectAnswers), 2); result.Mark = (int)Math.Round(result.Result / 10d, 0); return(result); }
public void ExamineFlight(ExaminerFlightRow cfr) { cfr.ForEachEvent((cfp) => { if (cfp.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropUASKnowledgeTest10773) { KnowledgeTest.AddRecentFlightEvents(cfr.dtFlight, 1); } if (cfp.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropUASTrainingCourse10774) { TrainingCourse.AddRecentFlightEvents(cfr.dtFlight, 1); } if (cfp.PropertyType.IsBFR && cfr.fIsRealAircraft) { BFR.AddRecentFlightEvents(cfr.dtFlight, 1); } }); }
public ActionResult Edit(KnowledgeTest knowledgeTest) { try { _knowledgeTestService.Update(new KnowledgeTest { //TODO:Alanlar buraya yazılacak Id alanı en altta olacak unutmayın!!! //Örn:BrandName = brand.BrandName, //BrandId = brand.BrandId KnowledgeTestId = knowledgeTest.KnowledgeTestId }); SuccessNotification("Kayıt Güncellendi"); return(RedirectToAction("KnowledgeTestIndex")); } catch { return(View()); } }
public async Task <KnowledgeTestModel> Execute(ExecuteTestModel model) { var template = await testTemplateRepository.GetQuery().FirstOrDefaultAsync(x => x.Id == model.Id); if (!template.IsActive) { throw new ApplicationException(); } var user = await currentUser.GetCurrentUserAsync(); var knowledgeTest = new KnowledgeTest { UserId = user.Id, TestTemplateId = template.Id, ExpiredAt = DateTime.UtcNow.AddMinutes(10), Questions = template.Questions.Select(x => new KnowledgeTestQuestion { QuestionTemplateId = x.Id, }).ToList(), }; knowledgeTestRepository.Add(knowledgeTest); await dataContext.SaveChangesAsync(); return(new KnowledgeTestModel { Id = knowledgeTest.Id, Name = knowledgeTest.TestTemplate.Name, Questions = knowledgeTest.Questions.Select(x => new KnowledgeQuestionModel { Id = x.Id, Name = x.QuestionTemplate.Name, ControlType = x.QuestionTemplate.ControlType, Answers = x.QuestionTemplate.Answers.Select(f => new KnowledgeAnswerModel { Id = f.Id, Answer = x.QuestionTemplate.ControlType == ControlType.Text ? null : f.Answer }).ToList() }).ToList() }); }
public void ExamineFlight(ExaminerFlightRow cfr) { if (cfr == null) { throw new ArgumentNullException(nameof(cfr)); } cfr.FlightProps.ForEachEvent((cfp) => { if (cfp.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropUASKnowledgeTest10773) { KnowledgeTest.AddRecentFlightEvents(cfr.dtFlight, 1); } if (cfp.PropTypeID == (int)CustomPropertyType.KnownProperties.IDPropUASTrainingCourse10774) { TrainingCourse.AddRecentFlightEvents(cfr.dtFlight, 1); } if (cfp.PropertyType.IsBFR && cfr.fIsRealAircraft) { BFR.AddRecentFlightEvents(cfr.dtFlight, 1); } }); }
public void Delete(KnowledgeTest knowledgeTest) { _knowledgeTestDal.Delete(knowledgeTest); }
public void Update(KnowledgeTest knowledgeTest) { _knowledgeTestDal.Update(knowledgeTest); }
public KnowledgeTest Add(KnowledgeTest knowledgeTest) { return(_knowledgeTestDal.Add(knowledgeTest)); }
public void Finalize(decimal totalTime, decimal picTime) { m_fcResult = KnowledgeTest.OR(TrainingCourse.AND(BFR)); }
public ActionResult Delete(int id, KnowledgeTest knowledgeTest) { var data = AutoMapperHelper.MapToSameViewModel <KnowledgeTest, KnowledgeTestViewModel>(_knowledgeTestService.GetById(id)); return(View(data.ToVM())); }