Exemplo n.º 1
0
        public async Task <IActionResult> UpdateExam(int id, ExamForUpdatedDto examForUpdatedDto)
        {
            var examFormRepo = await _repo.GetExam(id);

            var qOlds = await _repo.GetQuestionsByTest(id);

            var test = await _repo.GetTestQuestion(id);

            _mapper.Map(examForUpdatedDto, examFormRepo);
            await _repo.SaveAll();

            foreach (var t in test)
            {
                _repo.Delete(t);
            }

            foreach (var qNew in examForUpdatedDto.Questions)
            {
                var testQuestion = new TestQuestion
                {
                    TestId     = examFormRepo.Id,
                    QuestionId = qNew.Id
                };
                _repo.Add(testQuestion);
                await _repo.SaveAll();
            }

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Delete(int id)
        {
            await _exam.Delete(id);

            return(Ok(new
            {
                msg = "Deleted!"
            }));
        }
Exemplo n.º 3
0
        public Exam DeleteExam(int examId)
        {
            Exam foundExam = _examRepository.Find(examId);

            if (foundExam != null)
            {
                _questionRepository.DeleteQuestionsForExam(examId);

                _sectionRepository.DeleteSectionsForExam(examId);

                _examRepository.Delete(examId);

                _examRepository.Save();
            }

            return(foundExam);
        }
Exemplo n.º 4
0
        public string DeleteExamById(int examId)
        {
            string message        = null;
            var    willDeleteExam = _examRepo.GetAll().Where(e => e.Id == examId).FirstOrDefault();

            if (willDeleteExam != null)
            {
                var questionsOfWillDeleteExam = _questionRepo.GetAll().Where(q => q.ExamId == examId).ToList();
                if (questionsOfWillDeleteExam != null)
                {
                    for (int i = 0; i < questionsOfWillDeleteExam.Count; i++)
                    {
                        _questionRepo.Delete(questionsOfWillDeleteExam[i].Id);
                    }
                    _examRepo.Delete(examId);

                    message = willDeleteExam.CreateDate + " " + "tarihinde oluşturduğunuz" + " " + willDeleteExam.WiredTypingTitle + " " + "başlığını içeren sınav silinmiştir.";
                    return(message);
                }
            }
            message = "failed";
            return(message);
        }
Exemplo n.º 5
0
 public void DeleteExam(Exam exam)
 {
     examRepository.Delete(exam);
 }
Exemplo n.º 6
0
 public void DeleteExam(int examID)
 {
     _examRepository.Delete(_examRepository.GetById(examID));
 }
Exemplo n.º 7
0
 public bool Delete([FromBody] Guid examId)
 {
     return(examRepository.Delete(examId, examService.IsRandom(examId)));
 }
Exemplo n.º 8
0
 public IActionResult Delete(int id, int courseId)
 {
     examRepository.Delete(id);
     return(RedirectToAction("Index", new { courseId }));
 }
Exemplo n.º 9
0
 public int Delete(int id)
 {
     return(examRepository.Delete(id));
 }
Exemplo n.º 10
0
 public bool Delete(Guid examId)
 {
     return(examRepository.Delete(examId, IsRandom(examId)));
 }
Exemplo n.º 11
0
 public void Delete(Exam entity)
 {
     _examRepository.Delete(entity);
 }