Example #1
0
        public void RemoveRange(IEnumerable <Major> majors)
        {
            if (majors.Count() == 0)
            {
                throw new ArgumentNullException("majors");
            }

            var hasStudents = majors.Count(g => g.Students.Count > 0);

            if (hasStudents > 0)
            {
                throw new ForeignKeyEntityException("This major could not be removed. It has one or more students associated with it.");
            }

            _majorRepository.RemoveRange(majors);
        }