public void SendUserConfirmedNotification(UserConfirmedNotification notification, UserConfirmedCommand command) { using (var session = usersSessionFactory.CreateContext(true)) { var user = session.Users.Single(u => u.Id == command.UserId); notification.ToDisplayName = user.FirstName + " " + user.LastName; int type = command.PersonCodeStatus == 1 ? (int)NotificationTypes.UserConfirmed : (int)NotificationTypes.UserNotConfirmed; var not = session.Notifications.Single(n => n.Id == type); notification.MessageTemplate = not.Message; notification.Subject = not.Subject; foreach (var email in user.UserEmails) { notification.To = email.Email; notification.Execute(); } } }
public UserConfirmedCommandHandler(UserConfirmedNotification notification) { this.notification = notification; }