예제 #1
0
        public bool TryNotifyRecepients(List <string> recipients, string body)
        {
            bool        isAllRecipientsNotified = true;
            List <Task> notificationTasks       = new List <Task>();

            foreach (var recipient in recipients)
            {
                var notificationMessage = new NotificationMessage
                {
                    Body        = body,
                    RecipientId = recipient
                };

                notificationTasks.Add(_notificationProxy.Send(notificationMessage));
            }

            try
            {
                Task.WaitAll(notificationTasks.ToArray());
            }
            catch (AggregateException)
            {
                isAllRecipientsNotified = false;
            }


            return(isAllRecipientsNotified);
        }