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()); }
public async Task <IActionResult> Delete(int id) { await _exam.Delete(id); return(Ok(new { msg = "Deleted!" })); }
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); }
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); }
public void DeleteExam(Exam exam) { examRepository.Delete(exam); }
public void DeleteExam(int examID) { _examRepository.Delete(_examRepository.GetById(examID)); }
public bool Delete([FromBody] Guid examId) { return(examRepository.Delete(examId, examService.IsRandom(examId))); }
public IActionResult Delete(int id, int courseId) { examRepository.Delete(id); return(RedirectToAction("Index", new { courseId })); }
public int Delete(int id) { return(examRepository.Delete(id)); }
public bool Delete(Guid examId) { return(examRepository.Delete(examId, IsRandom(examId))); }
public void Delete(Exam entity) { _examRepository.Delete(entity); }