Ejemplo n.º 1
0
        public ISet <Section> DeleteAllSectionsForExam(int examId)
        {
            var sections = _sectionRepository.GetSectionsForExam(examId);

            if (sections.Any(section => HasQuestions(section.Id)))
            {
                return(null);
            }

            _sectionRepository.DeleteSectionsForExam(examId);

            _sectionRepository.Save();

            return(sections.ToHashSet());
        }
Ejemplo n.º 2
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);
        }