private MessageDelivery CreateDeliveries(Notification notification, UserDeliveryInformation deliveryInformation)
        {
            var destination = new MessageDelivery();

            if (notification.IsEmailEnabled)
            {
                destination.EmailContact = deliveryInformation.Email;
            }
            if (notification.IsSmsEnabled)
            {
                destination.SMSContact = deliveryInformation.Phone;
            }
            if (notification.IsPushEnabled)
            {
                destination.PushContact = deliveryInformation.DeviceId;
            }
            return(destination);
        }
示例#2
0
        public IEnumerable <UserDeliveryInformation> GetUsersDeliveryInformation(IEnumerable <string> users)
        {
            var result = new Collection <UserDeliveryInformation>();

            foreach (var id in users.Distinct())
            {
                var user = _userRepository.Get(id);
                var item = new UserDeliveryInformation
                {
                    Id       = user.Id,
                    User     = GetUserValidName(user),
                    Phone    = "8095551234",
                    DeviceId = "clientDeviceId-123",
                    Email    = user.UserName
                };
                result.Add(item);
            }
            return(result);
        }