Files
silver-octo-spoon/wolverine/getting-started/IssueCretaedHandler.cs
T

25 lines
804 B
C#

using System.Net.Mail;
namespace WolverineTutorial;
public static class IssueCreatedHandler
{
public static async Task Handle(IssueCreated created, IssueRepository repository)
{
var issue = repository.Get(created.Id);
var message = await BuildEmailMessage(issue);
using var client = new SmtpClient();
client.Send(message);
}
// This is a little helper method I made public
// Wolverine will not expose this as a message handler
private static Task<MailMessage> BuildEmailMessage(Issue issue)
{
// Build up a templated email message, with
// some sort of async method to look up additional
// data just so we can show off an async
// Wolverine Handler
return Task.FromResult(new MailMessage());
}
}