public void Handles(StudentUnrollCommand command) { var student = _studentRepository.GetById(command.StudentId); var @class = _classRepository.GetById(command.ClassId); var studentArchive = _studentArchiveRepository.GetById(command.StudentId); student.Unroll(@class); @class.Unroll(student); studentArchive.AddToPassedEnrollements(student.LastUnrolled, command.Reason); }
public void Handles(StudentUnrollCommand command) { var student = _studentRepository.GetById(command.StudentId); var @class = _classRepository.GetById(command.ClassId); var studentArchive = _studentArchiveRepository.GetById(command.StudentId); _unitOfWork.BeginTransaction(); student.Unroll(@class); @class.Unroll(student); studentArchive.AddToPassedEnrollements(student.LastUnrolled, command.Reason); _notificationService.Notify(student); _unitOfWork.Commit(); }