diff --git a/HardwareShop/HardwareShopRestApi/HardwareShopRestApi.csproj b/HardwareShop/HardwareShopRestApi/HardwareShopRestApi.csproj new file mode 100644 index 0000000..40effd1 --- /dev/null +++ b/HardwareShop/HardwareShopRestApi/HardwareShopRestApi.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + + diff --git a/HardwareShop/HardwareShopRestApi/Program.cs b/HardwareShop/HardwareShopRestApi/Program.cs new file mode 100644 index 0000000..0a34d12 --- /dev/null +++ b/HardwareShop/HardwareShopRestApi/Program.cs @@ -0,0 +1,58 @@ +using HardwareShopBusinessLogic.BusinessLogics; +using HardwareShopBusinessLogic.BusinessLogics.Storekeeper; +using HardwareShopContracts.BuisnessLogicsContracts; +using HardwareShopContracts.BusinessLogicsContracts; +using HardwareShopContracts.StoragesContracts; +using HardwareShopDatabaseImplement.Implements; +using HardwareShopDatabaseImplement.Implements.Storekeeper; +using HardwareShopDatabaseImplement.Implements.Worker; +using Microsoft.OpenApi.Models; +using NLog.Extensions.Logging; + +var builder = WebApplication.CreateBuilder(args); + +builder.Logging.SetMinimumLevel(LogLevel.Information); +builder.Logging.AddNLog("nlog.config"); + +// Add services to the container. +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo { Title = "HardwareShopRestApi", Version = "v1" }); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "HardwareShopRestApi v1")); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/HardwareShop/HardwareShopRestApi/Properties/launchSettings.json b/HardwareShop/HardwareShopRestApi/Properties/launchSettings.json new file mode 100644 index 0000000..0750b89 --- /dev/null +++ b/HardwareShop/HardwareShopRestApi/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:45313", + "sslPort": 44367 + } + }, + "profiles": { + "HardwareShopRestApi": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7205;http://localhost:5205", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/HardwareShop/HardwareShopRestApi/appsettings.Development.json b/HardwareShop/HardwareShopRestApi/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/HardwareShop/HardwareShopRestApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/HardwareShop/HardwareShopRestApi/appsettings.json b/HardwareShop/HardwareShopRestApi/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/HardwareShop/HardwareShopRestApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/HardwareShop/HardwareShopRestApi/nlog.config b/HardwareShop/HardwareShopRestApi/nlog.config new file mode 100644 index 0000000..85797a7 --- /dev/null +++ b/HardwareShop/HardwareShopRestApi/nlog.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/HardwareShop/HardwareShopView.sln b/HardwareShop/HardwareShopView.sln index cbb23be..7f6fc08 100644 --- a/HardwareShop/HardwareShopView.sln +++ b/HardwareShop/HardwareShopView.sln @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.3.32929.385 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HardwareShopView", "HardwareShopView\HardwareShopView.csproj", "{14E5377A-FF6B-4FBA-B18A-5F6EB513123C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HardwareShopDataModels", "HardwareShopDataModels\HardwareShopDataModels.csproj", "{1589524F-918D-40B8-A44B-8C7FCABFD29A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HardwareShopDataModels", "HardwareShopDataModels\HardwareShopDataModels.csproj", "{1589524F-918D-40B8-A44B-8C7FCABFD29A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HardwareShopContracts", "HardwareShopContracts\HardwareShopContracts.csproj", "{91B12343-FCFB-4B7D-BBB8-C6A2C9D73996}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HardwareShopContracts", "HardwareShopContracts\HardwareShopContracts.csproj", "{91B12343-FCFB-4B7D-BBB8-C6A2C9D73996}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HardwareShopBusinessLogic", "HardwareShopBusinessLogic\HardwareShopBusinessLogic.csproj", "{3B96A73E-3385-4712-A7C4-9D67D424CE43}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HardwareShopBusinessLogic", "HardwareShopBusinessLogic\HardwareShopBusinessLogic.csproj", "{3B96A73E-3385-4712-A7C4-9D67D424CE43}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HardwareShopDatabaseImplement", "HardwareShopDatabaseImplement\HardwareShopDatabaseImplement.csproj", "{1E5156F6-1F67-497C-A660-8AC61BC451BC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HardwareShopDatabaseImplement", "HardwareShopDatabaseImplement\HardwareShopDatabaseImplement.csproj", "{1E5156F6-1F67-497C-A660-8AC61BC451BC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HardwareShopRestApi", "HardwareShopRestApi\HardwareShopRestApi.csproj", "{623AF3E7-85DA-4DB7-BC0E-8D669CEE9402}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,10 +19,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {14E5377A-FF6B-4FBA-B18A-5F6EB513123C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14E5377A-FF6B-4FBA-B18A-5F6EB513123C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14E5377A-FF6B-4FBA-B18A-5F6EB513123C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14E5377A-FF6B-4FBA-B18A-5F6EB513123C}.Release|Any CPU.Build.0 = Release|Any CPU {1589524F-918D-40B8-A44B-8C7FCABFD29A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1589524F-918D-40B8-A44B-8C7FCABFD29A}.Debug|Any CPU.Build.0 = Debug|Any CPU {1589524F-918D-40B8-A44B-8C7FCABFD29A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -39,6 +35,10 @@ Global {1E5156F6-1F67-497C-A660-8AC61BC451BC}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E5156F6-1F67-497C-A660-8AC61BC451BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {1E5156F6-1F67-497C-A660-8AC61BC451BC}.Release|Any CPU.Build.0 = Release|Any CPU + {623AF3E7-85DA-4DB7-BC0E-8D669CEE9402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {623AF3E7-85DA-4DB7-BC0E-8D669CEE9402}.Debug|Any CPU.Build.0 = Debug|Any CPU + {623AF3E7-85DA-4DB7-BC0E-8D669CEE9402}.Release|Any CPU.ActiveCfg = Release|Any CPU + {623AF3E7-85DA-4DB7-BC0E-8D669CEE9402}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE