Exemple #1
0
        protected override async Task OnCommandCompleted(IReadWriteDataSource dataSource, InviteUser auditTrailEntry, Invitation result)
        {
            var emailQueueClient = SendAsEmail ? _queueDataSource.GetQueueClient(_emailQueueName) : null;

            if (result.EmailBatch != null)
            {
                // If we've got an email batch, then we need to put the message onto the queue!
                var messageToCreate = ServiceBusUtilities.GenerateMessage(new { Metadata = new { baseUrl = _baseUrl } }, result.EmailBatch.ServiceBusMessageId);

                await emailQueueClient.SendAsync(messageToCreate);

                // Don't need to expose this to the clients though
                Invitation.EmailBatch.ServiceBusMessageId = null;
            }
        }
        protected override async Task OnCommandCompleted(IReadWriteDataSource dataSource, ModifyNotification auditTrailEntry, Notification result)
        {
            if (result.EmailBatch != null)
            {
                if (_sendEmail)
                {
                    var emailQueueClient = SendAsEmail ? _queueDataSource.GetQueueClient(_emailQueueName) : null;

                    // If we've created an email batch, then we need to put the message onto the queue!
                    var messageToCreate = ServiceBusUtilities.GenerateMessage(new { Metadata = default(object) }, result.EmailBatch.ServiceBusMessageId, result.StartDate);

                    await emailQueueClient.SendAsync(messageToCreate);
                }

                // Make sure we don't expose the queue's message ID - clients don't need to care
                result.EmailBatch.ServiceBusMessageId = null;
            }
        }