Adding
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using LCU.Library.Internal.NotificationsModels.Models;
|
||||
using LCU.Api.Internal.DispatcherSharedLib.Configurations;
|
||||
using LCU.Api.Internal.DispatcherSharedLib.Utilities;
|
||||
using LCU.Api.Internal.Dispatcher.DataAccess;
|
||||
|
||||
namespace LCU.Api.Internal.Dispatcher.Services;
|
||||
|
||||
public class NotificationService : INotificationService
|
||||
{
|
||||
private readonly INotificationsApiDao _notificationsApiDao;
|
||||
|
||||
public NotificationService(INotificationsApiDao notificationsApiDao)
|
||||
{
|
||||
_notificationsApiDao = notificationsApiDao;
|
||||
}
|
||||
|
||||
public async Task<bool> SendEmailAsync(string recipient, string subject, string emailTemplate)
|
||||
{
|
||||
try
|
||||
{
|
||||
var emailRequest = new EmailRequest
|
||||
{
|
||||
Recipient = new List<string>() { recipient },
|
||||
Subject = subject,
|
||||
Body = emailTemplate
|
||||
};
|
||||
|
||||
await _notificationsApiDao.SendEmailAsync(emailRequest);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error(exception, $"Failure to send email from Dispatcher");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user