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))); }
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(); }
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(); }