Merging RestAPI to EmployeeApp

This commit is contained in:
Yuee Shiness 2023-05-19 02:43:59 +04:00
commit ad23e94dea
3 changed files with 22 additions and 3 deletions

View File

@ -11,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
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerStoreEmployeeApp", "..\ComputerStoreEmployeeApp\ComputerStoreEmployeeApp.csproj", "{E1091CF6-5350-402F-A305-2973C96D2AC5}"
EndProject

View File

@ -1,4 +1,5 @@
using ComputerStoreBusinessLogic.BusinessLogic;
using ComputerStoreBusinessLogic.MailStuff;
using ComputerStoreContracts.BindingModels;
using ComputerStoreContracts.BusinessLogicContracts;
using ComputerStoreContracts.StorageContracts;
@ -30,6 +31,8 @@ builder.Services.AddTransient<IConsignmentLogic,ConsignmentLogic>();
builder.Services.AddTransient<IRequestComponentLogic, RequestComponentLogic>();
builder.Services.AddTransient<IRequestLogic, RequestLogic>();
builder.Services.AddSingleton<AbstractMail, MailKit>();
builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
@ -40,8 +43,17 @@ AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
var app = builder.Build();
var mailSender = app.Services.GetService<AbstractMail>();
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())
{

View File

@ -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"
}