diff --git a/ComputerStore/ComputerStore.sln b/ComputerStore/ComputerStore.sln
index c2f7b18..c371038 100644
--- a/ComputerStore/ComputerStore.sln
+++ b/ComputerStore/ComputerStore.sln
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerStoreEmployeeApp", "ComputerStoreEmployeeApp.csproj", "{695B79EB-71FD-456D-BFEA-634500FF2ECB}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerStoreBusinessLogic", "..\ComputerStoreBusinessLogic\ComputerStoreBusinessLogic.csproj", "{17F8960F-03CB-49D7-B335-931E6BE5F9FF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerStoreContracts", "..\ComputerStoreContracts\ComputerStoreContracts.csproj", "{1C8DB816-F530-4CC3-9F36-F6191FE49C10}"
@@ -13,7 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerStoreDataModels", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerStoreDatabaseImplement", "..\ComputerStoreDatabaseImplement\ComputerStoreDatabaseImplement.csproj", "{24D66D03-F9DA-46C0-8C52-F55DDACDE8AF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerStoreRestAPI", "..\ComputerStoreRestAPI\ComputerStoreRestAPI.csproj", "{11E7B5B7-7AF5-4E1E-837F-E6645D3C0EFB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerStoreRestAPI", "..\ComputerStoreRestAPI\ComputerStoreRestAPI.csproj", "{11E7B5B7-7AF5-4E1E-837F-E6645D3C0EFB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,10 +19,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {695B79EB-71FD-456D-BFEA-634500FF2ECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {695B79EB-71FD-456D-BFEA-634500FF2ECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {695B79EB-71FD-456D-BFEA-634500FF2ECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {695B79EB-71FD-456D-BFEA-634500FF2ECB}.Release|Any CPU.Build.0 = Release|Any CPU
{17F8960F-03CB-49D7-B335-931E6BE5F9FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17F8960F-03CB-49D7-B335-931E6BE5F9FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17F8960F-03CB-49D7-B335-931E6BE5F9FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/ComputerStoreRestAPI/ComputerStoreRestAPI.csproj b/ComputerStoreRestAPI/ComputerStoreRestAPI.csproj
index 2c31334..c6f0236 100644
--- a/ComputerStoreRestAPI/ComputerStoreRestAPI.csproj
+++ b/ComputerStoreRestAPI/ComputerStoreRestAPI.csproj
@@ -11,7 +11,9 @@
+
+
diff --git a/ComputerStoreRestAPI/Program.cs b/ComputerStoreRestAPI/Program.cs
index ea66968..5e1826a 100644
--- a/ComputerStoreRestAPI/Program.cs
+++ b/ComputerStoreRestAPI/Program.cs
@@ -1,4 +1,6 @@
using ComputerStoreBusinessLogic.BusinessLogic;
+using ComputerStoreBusinessLogic.MailStuff;
+using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.BusinessLogicContracts;
using ComputerStoreContracts.StorageContracts;
using ComputerStoreDatabaseImplement.Implements;
@@ -27,6 +29,8 @@ builder.Services.AddTransient();
builder.Services.AddTransient();
builder.Services.AddTransient();
+builder.Services.AddSingleton();
+
builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
@@ -34,7 +38,17 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
+var mailSender = app.Services.GetService();
+mailSender?.MailConfig(new MailConfigBindingModel
+{
+ Login = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
+ Password = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
+ SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
+ SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
+ PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
+ PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
+});
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
diff --git a/ComputerStoreRestAPI/appsettings.json b/ComputerStoreRestAPI/appsettings.json
index 10f68b8..af4147a 100644
--- a/ComputerStoreRestAPI/appsettings.json
+++ b/ComputerStoreRestAPI/appsettings.json
@@ -5,5 +5,12 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "AllowedHosts": "*"
+ "AllowedHosts": "*",
+
+ "SmtpClientHost": "smtp.rambler.ru",
+ "SmtpClientPort": "587",
+ "PopHost": "pop.rambler.ru",
+ "PopPort": "995",
+ "MailLogin": "tmpmailforlabs@rambler.ru",
+ "MailPassword": "0paRVbmA"
}