private void RegisterUserDonatorNotificationTypes(RegisterNewDonatorUserCommand command,
                                                          User user)
        {
            var notificationsTypes = new List <NotificationType>();

            if (command.ActivedBloodNotification)
            {
                notificationsTypes.Add(_notificationTypeRepository.GetByName(NotificationTypeConfiguration.Blood));
            }
            if (command.ActivedHairNotification)
            {
                notificationsTypes.Add(_notificationTypeRepository.GetByName(NotificationTypeConfiguration.Hair));
            }
            if (command.ActivedBreastMilkNotification)
            {
                notificationsTypes.Add(_notificationTypeRepository.GetByName(NotificationTypeConfiguration.BreastMilk));
            }

            foreach (var notificationType in notificationsTypes)
            {
                _userNotificationTypeRepository.Add(new UserNotificationType(Guid.NewGuid(),
                                                                             notificationType.Id,
                                                                             user.Id));
            }
        }
Пример #2
0
 /// <summary>
 /// Get notification type by name
 /// </summary>
 /// <param name="notificationTypeName"></param>
 /// <returns></returns>
 public NotificationTypeDomain GetNotificationTypeByName(string notificationTypeName)
 {
     ValidationHelper.NotNullOrWhitespace(notificationTypeName, NotificationMessages.NotificationTypeNameEmpty);
     return(_repository.GetByName(notificationTypeName));
 }