mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +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 class EmailService : IIdentityMessageService
|
||||||
{
|
{
|
||||||
public Task SendAsync(IdentityMessage message)
|
public async Task SendAsync(IdentityMessage message)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace Project_Unite
|
||||||
var db = new ApplicationDbContext();
|
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.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();
|
db.SaveChanges();
|
||||||
smtp.SendCompleted += (o, a) =>
|
smtp.SendCompleted += async (o, a) =>
|
||||||
{
|
{
|
||||||
var alog = new AuditLog("system", AuditLogLevel.Admin, "");
|
var alog = new AuditLog("system", AuditLogLevel.Admin, "");
|
||||||
if (a.Cancelled == true)
|
if (a.Cancelled == true)
|
||||||
|
@ -52,7 +52,7 @@ namespace Project_Unite
|
||||||
alog.Description += $"Error:<br/><pre><code class=\"language-csharp\">{a.Error}</code></pre>";
|
alog.Description += $"Error:<br/><pre><code class=\"language-csharp\">{a.Error}</code></pre>";
|
||||||
var ndb = new ApplicationDbContext();
|
var ndb = new ApplicationDbContext();
|
||||||
ndb.AuditLogs.Add(alog);
|
ndb.AuditLogs.Add(alog);
|
||||||
ndb.SaveChanges();
|
await ndb.SaveChangesAsync();
|
||||||
};
|
};
|
||||||
smtp.SendAsync(sMsg, null);
|
smtp.SendAsync(sMsg, null);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace Project_Unite
|
||||||
{ex}"));
|
{ex}"));
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
}
|
||||||
return Task.FromResult(0);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue