mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
more asynchrous stuff
This commit is contained in:
parent
ad575bcd38
commit
6a9ce408d8
1 changed files with 4 additions and 4 deletions
|
@ -18,7 +18,7 @@ namespace Project_Unite
|
|||
{
|
||||
public class EmailService : IIdentityMessageService
|
||||
{
|
||||
public Task SendAsync(IdentityMessage message)
|
||||
public async Task SendAsync(IdentityMessage message)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public Task SendAsync(IdentityMessage message)
|
|||
var db = new ApplicationDbContext();
|
||||
db.AuditLogs.Add(new AuditLog("system", AuditLogLevel.Admin, $"Email sending...<br/><br/><strong>To:</strong> {sMsg.To}<br/><strong>Subject:</strong><br/>{sMsg.Subject}"));
|
||||
db.SaveChanges();
|
||||
smtp.SendCompleted += (o, a) =>
|
||||
smtp.SendCompleted += async (o, a) =>
|
||||
{
|
||||
var alog = new AuditLog("system", AuditLogLevel.Admin, "");
|
||||
if (a.Cancelled == true)
|
||||
|
@ -52,7 +52,7 @@ public Task SendAsync(IdentityMessage message)
|
|||
alog.Description += $"Error:<br/><pre><code class=\"language-csharp\">{a.Error}</code></pre>";
|
||||
var ndb = new ApplicationDbContext();
|
||||
ndb.AuditLogs.Add(alog);
|
||||
ndb.SaveChanges();
|
||||
await ndb.SaveChangesAsync();
|
||||
};
|
||||
smtp.SendAsync(sMsg, null);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public Task SendAsync(IdentityMessage message)
|
|||
{ex}"));
|
||||
db.SaveChanges();
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue