public async Task <string> RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var vm = context.GetInput <PersonViewModel>(); string id = await context.CallActivityAsync <string>(ConfirmationTask.CreatePerson, vm); var vmUpdate = PersonUpdateViewModel.Create(vm); vmUpdate.Id = id; var activateSendMail = new ActivatePersonSendMail { Data = vmUpdate, InstanceId = context.InstanceId }; await context.CallActivityAsync(ConfirmationTask.SendMailPerson, activateSendMail); await HumanInteractionPerson(context, vmUpdate); return(id); }
public async Task ConfirmPerson([ActivityTrigger] ActivatePersonSendMail activateSendMail, [SendGrid(ApiKey = "SendGridConnections:ApiKey")] IAsyncCollector <SendGridMessage> messageCollector, ILogger log) { var personData = activateSendMail.Data; SendGridMessage message = new SendGridMessage(); message.SetFrom(new EmailAddress(sendGridSettings.From)); message.AddTos(adminSettings.GetMails().Select(x => new EmailAddress(x)).ToList()); message.SetSubject($"New Person submitted: {personData.Name}"); message.SetTemplateId(sendGridSettings.TemplatePersonId); message.SetTemplateData(new MailPersonTemplateData { confirmurl = adminSettings.GetConfirmationPersonLink(activateSendMail.InstanceId, true), aborturl = adminSettings.GetConfirmationPersonLink(activateSendMail.InstanceId, false), personname = personData.Name, personsurname = personData.Surname, personmvpcode = personData.MVP_Code }); await messageCollector.AddAsync(message); }