Esempio n. 1
0
        public StudentBL GetStudentByID(int studentID)
        {
            if (!Utilities.CheckIdForNegativ(studentID))
            {
                var ex = new NegativeIDException($"ID = {studentID}");
                _logger.LogWarning(ex, $"ID = {studentID}");
                throw ex;
            }

            return(_mapper.Map <StudentBL>(_studentRepository.GetStudentByID(studentID)));
        }
Esempio n. 2
0
        public void DeleteStudent(int studentID)
        {
            if (!Utilities.CheckIdForNegativ(studentID))
            {
                var ex = new NegativeIDException($"ID = {studentID}");
                _logger.LogWarning(ex, $"ID = {studentID}");
                throw ex;
            }

            _studentRepository.DeleteStudent(studentID);
            _studentRepository.Save();
        }
Esempio n. 3
0
 public void InsertStudent(StudentBL student)
 {
     if (!Utilities.CheckIdForNegativ(student.ID))
     {
         var ex = new NegativeIDException($"ID = {student.ID}");
         _logger.LogWarning(ex, $"ID = {student.ID}");
         throw ex;
     }
     if (!Utilities.CheckEmailAddress(student.EMail))
     {
         var ex = new WrongEmailException($"Email = {student.EMail}");
         _logger.LogWarning(ex, $"Email = {student.EMail}");
         throw ex;
     }
     _studentRepository.InsertStudent(_mapper.Map <Student>(student));
     _studentRepository.Save();
 }