Так будет лучше
This commit is contained in:
parent
92f4c08128
commit
7755e3d482
@ -289,18 +289,31 @@ public class HomeController : Controller
|
|||||||
/// Îòïðàâèòü ïî ïî÷òå îò÷¸ò
|
/// Îòïðàâèòü ïî ïî÷òå îò÷¸ò
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void SendReport()
|
public void SendReport(DateTime dateFrom, DateTime dateTo)
|
||||||
{
|
{
|
||||||
if (APIClient.User == null)
|
if (APIClient.User == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Íåîáõîäèìî àâòîðèçîâàòüñÿ!");
|
throw new Exception("Íåîáõîäèìî àâòîðèçîâàòüñÿ!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dateFrom == DateTime.MinValue || dateTo == DateTime.MinValue)
|
||||||
|
{
|
||||||
|
throw new Exception("Ââåäåíû íå âñå äàííûå!");
|
||||||
|
}
|
||||||
|
|
||||||
|
_reportLogic.SaveVisitsInfoToPdfFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = $@"D:\report.pdf",
|
||||||
|
UserId = APIClient.User.Id,
|
||||||
|
DateFrom = dateFrom,
|
||||||
|
DateTo = dateTo
|
||||||
|
});
|
||||||
|
|
||||||
_mailLogic.MailSendAsync(new MailSendInfoBindingModel
|
_mailLogic.MailSendAsync(new MailSendInfoBindingModel
|
||||||
{
|
{
|
||||||
MailAddress = APIClient.User.Email,
|
MailAddress = APIClient.User.Email,
|
||||||
Subject = $"Îò÷åò {APIClient.User.FullName}",
|
Subject = $"Îò÷åò {APIClient.User.FullName}",
|
||||||
Text = "Âàø îò÷åò",
|
Text = $@"Âàø îò÷åò ñ {dateFrom} ïî {dateTo}",
|
||||||
Path = "D:\\report.pdf"
|
Path = "D:\\report.pdf"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user