31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using LCU.API.Internal.DocumentLib.DataAccess;
|
|
using LCU.API.Internal.NotificationsApiLib.Models;
|
|
using LCU.Library.Internal.Exceptions;
|
|
using Serilog;
|
|
|
|
namespace LCU.API.Internal.Document.Services
|
|
{
|
|
public class NotificationApiService : INotificationApiService
|
|
{
|
|
private readonly INotificationApiDao _notificationServiceApiDao;
|
|
|
|
public NotificationApiService(INotificationApiDao notificationApiServiceDao)
|
|
{
|
|
_notificationServiceApiDao = notificationApiServiceDao;
|
|
}
|
|
|
|
public async Task SendEmailAsync(EmailRequest emailRequest)
|
|
{
|
|
try
|
|
{
|
|
await _notificationServiceApiDao.SendEmailAsync(emailRequest);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
Log.Error(exception, $"Failure to send email. Subject: {emailRequest.Subject}; Recipients: {String.Join(", ", emailRequest.Recipient)}");
|
|
throw new ServiceException($"Failure to send email. Subject: {emailRequest.Subject}; Recipients: {String.Join(", ", emailRequest.Recipient)}; Exception Message: {exception.Message}");
|
|
}
|
|
}
|
|
}
|
|
}
|