public async Task SendRegistrationConfirmationEmailAsync(ConfirmRegistrationMessage model)
		{
			var template = new ConfirmRegistration();
			template.ConfirmationCode = model.Token;

			var text = template.TransformText();

			var message = new SendGridMessage();
			message.To = new[] { new MailAddress(model.Email, model.FullName) };
			message.Subject = string.Format("Подтверждение регистрации на AZUREday {0}", Configuration.Year);
			message.Html = text;
			message.From = new MailAddress(Configuration.SendGridFromEmail, Configuration.SendGridFromName);
			message.ReplyTo = new[] { new MailAddress(Configuration.SendGridFromEmail, Configuration.SendGridFromName) };

			await SendEmail(message);
		}
예제 #2
0
		public async Task RegisterAsync(Attendee attendee)
		{
			var data = AppFactory.Mapper.Value.Map<Data.Entity.Table.Attendee>(attendee);

			var token = new QuickAuthToken
			{
				Email = attendee.EMail,
				Token = Guid.NewGuid().ToString("N")
			};

			var email = new ConfirmRegistrationMessage
			{
				Email = attendee.EMail,
				FullName = attendee.FullName,
				Token = token.Token
			};

			await Task.WhenAll(
				DataFactory.AttendeeService.Value.InsertAsync(data),
				AppFactory.QuickAuthTokenService.Value.AddQuickAuthTokenAsync(token),
				NotificationFactory.AttendeeNotificationService.Value.SendRegistrationConfirmationEmailAsync(email)
			);
		}