Отображение писем клиента
This commit is contained in:
parent
6deb6698e4
commit
f2a6d47960
@ -51,8 +51,8 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
_mailKitWorker.MailSendAsync(new MailSendInfoBindingModel
|
_mailKitWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||||
{
|
{
|
||||||
MailAddress = (_clientStorage.GetElement(new ClientSearchModel { Id = newOrder.ClientId})).Email,
|
MailAddress = (_clientStorage.GetElement(new ClientSearchModel { Id = newOrder.ClientId})).Email,
|
||||||
Subject = $"Заказ номер {model.Id}",
|
Subject = $"Заказ номер",
|
||||||
Text = "Ваш заказ успешно принят"
|
Text = $"Ваш заказ успешно принят. Машина: {model.CarName} в количестве: {model.Count} выйдет на сумму: {model.Sum}"
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,15 @@ using Microsoft.Extensions.Logging;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using AutomobilePlantContracts.StoragesContracts;
|
||||||
|
using AutomobilePlantContracts.SearchModel;
|
||||||
|
|
||||||
namespace AutomobilePlantBusinessLogic.MailWorker
|
namespace AutomobilePlantBusinessLogic.MailWorker
|
||||||
{
|
{
|
||||||
public class MailKitWorker : AbstractMailWorker
|
public class MailKitWorker : AbstractMailWorker
|
||||||
{
|
{
|
||||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic) : base(logger, messageInfoLogic) { }
|
private readonly IClientStorage _clientStorage;
|
||||||
|
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic, IClientStorage clientStorage) : base(logger, messageInfoLogic) { _clientStorage = clientStorage; }
|
||||||
|
|
||||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
||||||
{
|
{
|
||||||
@ -58,11 +61,12 @@ namespace AutomobilePlantBusinessLogic.MailWorker
|
|||||||
list.Add(new MessageInfoBindingModel
|
list.Add(new MessageInfoBindingModel
|
||||||
{
|
{
|
||||||
DateDelivery = DateTime.SpecifyKind(message.Date.DateTime, DateTimeKind.Utc),
|
DateDelivery = DateTime.SpecifyKind(message.Date.DateTime, DateTimeKind.Utc),
|
||||||
|
ClientId = _clientStorage.GetElement(new ClientSearchModel { Email = mail.Address }).Id,
|
||||||
MessageId = message.MessageId,
|
MessageId = message.MessageId,
|
||||||
SenderName = mail.Address,
|
SenderName = mail.Address,
|
||||||
Subject = message.Subject,
|
Subject = message.Subject,
|
||||||
Body = message.TextBody
|
Body = message.TextBody
|
||||||
});
|
}); ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ namespace AutoPlantClientApp.Controllers
|
|||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?ClientId={APIClient.Client.Id}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user