From b558c092292e4d13abae9a46389533a3573fd853 Mon Sep 17 00:00:00 2001 From: dex_moth Date: Thu, 2 May 2024 09:33:43 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComputerHardwareStore.sln | 8 +- .../ComputerHardwareStoreStoreKeeperApp.http | 6 - .../Controllers/HomeController.cs | 143 ++++++++++++++++++ .../Models/ErrorViewModel.cs | 9 ++ .../StoreKeeperClient.csproj | 4 - .../StoreKeeperClient.http | 6 + .../Controllers/WeatherForecastController.cs | 33 ---- .../WebApplication1/Program.cs | 25 --- .../Properties/launchSettings.json | 41 ----- .../WebApplication1/WeatherForecast.cs | 13 -- .../WebApplication1/WebApplication1.csproj | 13 -- .../WebApplication1/WebApplication1.http | 6 - .../appsettings.Development.json | 8 - .../WebApplication1/appsettings.json | 9 -- 14 files changed, 162 insertions(+), 162 deletions(-) delete mode 100644 ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/ComputerHardwareStoreStoreKeeperApp.http create mode 100644 ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Controllers/HomeController.cs create mode 100644 ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Models/ErrorViewModel.cs create mode 100644 ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.http delete mode 100644 ComputerHardwareStore/WebApplication1/Controllers/WeatherForecastController.cs delete mode 100644 ComputerHardwareStore/WebApplication1/Program.cs delete mode 100644 ComputerHardwareStore/WebApplication1/Properties/launchSettings.json delete mode 100644 ComputerHardwareStore/WebApplication1/WeatherForecast.cs delete mode 100644 ComputerHardwareStore/WebApplication1/WebApplication1.csproj delete mode 100644 ComputerHardwareStore/WebApplication1/WebApplication1.http delete mode 100644 ComputerHardwareStore/WebApplication1/appsettings.Development.json delete mode 100644 ComputerHardwareStore/WebApplication1/appsettings.json diff --git a/ComputerHardwareStore/ComputerHardwareStore.sln b/ComputerHardwareStore/ComputerHardwareStore.sln index d2b8921..6b1bbc8 100644 --- a/ComputerHardwareStore/ComputerHardwareStore.sln +++ b/ComputerHardwareStore/ComputerHardwareStore.sln @@ -49,14 +49,14 @@ Global {20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Debug|Any CPU.Build.0 = Debug|Any CPU {20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Release|Any CPU.ActiveCfg = Release|Any CPU {20E4D287-C0F4-4DAB-B338-349F8B6EA22B}.Release|Any CPU.Build.0 = Release|Any CPU - {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Release|Any CPU.Build.0 = Release|Any CPU {BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Release|Any CPU.Build.0 = Release|Any CPU + {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/ComputerHardwareStoreStoreKeeperApp.http b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/ComputerHardwareStoreStoreKeeperApp.http deleted file mode 100644 index 2523011..0000000 --- a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/ComputerHardwareStoreStoreKeeperApp.http +++ /dev/null @@ -1,6 +0,0 @@ -@ComputerHardwareStoreStoreKeeperApp_HostAddress = http://localhost:5062 - -GET {{ComputerHardwareStoreStoreKeeperApp_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Controllers/HomeController.cs b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Controllers/HomeController.cs new file mode 100644 index 0000000..10b2883 --- /dev/null +++ b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Controllers/HomeController.cs @@ -0,0 +1,143 @@ +using ComputerHardwareStoreContracts.ViewModels; +using Microsoft.AspNetCore.Mvc; +using System.Diagnostics; +using StoreKeeperClient.Models; + +namespace StoreKeeperClient.Controllers +{ + public class HomeController : Controller + { + private readonly ILogger _logger; + + public HomeController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IActionResult Index() + { + return View(); + } + + [HttpGet] + public IActionResult Privacy() + { + return View(); + } + + [HttpGet] + public IActionResult Enter() + { + return View(); + } + + [HttpGet] + public IActionResult Register() + { + return View(); + } + + [HttpGet] + public IActionResult AddBuildToPurchase() + { + return View(); + } + + [HttpGet] + public IActionResult Builds() + { + return View(new List()); + } + + [HttpGet] + public IActionResult BuildCreate() + { + return View(); + } + + [HttpGet] + public IActionResult BuildDelete() + { + return View(); + } + + [HttpGet] + public IActionResult BuildUpdate() + { + return View(); + } + + [HttpGet] + public IActionResult CommentCreate() + { + return View(); + } + + [HttpGet] + public IActionResult CommentDelete() + { + return View(); + } + + [HttpGet] + public IActionResult CommentUpdate() + { + return View(); + } + + [HttpGet] + public IActionResult Comments() + { + return View(new List()); + } + + [HttpGet] + public IActionResult ProductsList() + { + return View(new List()); + } + + [HttpGet] + public IActionResult PurchaseCreate() + { + return View(); + } + + [HttpGet] + public IActionResult PurchaseDelete() + { + return View(); + } + + [HttpGet] + public IActionResult Purchases() + { + return View(new List()); + } + + [HttpGet] + public IActionResult PurchaseUpdate() + { + return View(); + } + + [HttpGet] + public IActionResult Report() + { + return View(new List()); + } + + [HttpPost] + public void Report(string password) + { + Response.Redirect("ReportOnly"); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} diff --git a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Models/ErrorViewModel.cs b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Models/ErrorViewModel.cs new file mode 100644 index 0000000..4bc9eeb --- /dev/null +++ b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/Models/ErrorViewModel.cs @@ -0,0 +1,9 @@ +namespace StoreKeeperClient.Models +{ + public class ErrorViewModel + { + public string? RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} diff --git a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.csproj b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.csproj index 716311a..f31c7c3 100644 --- a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.csproj +++ b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.csproj @@ -10,10 +10,6 @@ - - - - diff --git a/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.http b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.http new file mode 100644 index 0000000..e852e7c --- /dev/null +++ b/ComputerHardwareStore/ComputerHardwareStoreStoreKeeperApp/StoreKeeperClient.http @@ -0,0 +1,6 @@ +@StoreKeeperCLient_HostAddress = http://localhost:5062 + +GET {{StoreKeeperCLient_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/ComputerHardwareStore/WebApplication1/Controllers/WeatherForecastController.cs b/ComputerHardwareStore/WebApplication1/Controllers/WeatherForecastController.cs deleted file mode 100644 index 8e0ea76..0000000 --- a/ComputerHardwareStore/WebApplication1/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace WebApplication1.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} diff --git a/ComputerHardwareStore/WebApplication1/Program.cs b/ComputerHardwareStore/WebApplication1/Program.cs deleted file mode 100644 index 48863a6..0000000 --- a/ComputerHardwareStore/WebApplication1/Program.cs +++ /dev/null @@ -1,25 +0,0 @@ -var builder = WebApplication.CreateBuilder(args); - -// Add services to the container. - -builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); - -var app = builder.Build(); - -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} - -app.UseHttpsRedirection(); - -app.UseAuthorization(); - -app.MapControllers(); - -app.Run(); diff --git a/ComputerHardwareStore/WebApplication1/Properties/launchSettings.json b/ComputerHardwareStore/WebApplication1/Properties/launchSettings.json deleted file mode 100644 index 55337e7..0000000 --- a/ComputerHardwareStore/WebApplication1/Properties/launchSettings.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:19732", - "sslPort": 44357 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:5174", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7272;http://localhost:5174", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/ComputerHardwareStore/WebApplication1/WeatherForecast.cs b/ComputerHardwareStore/WebApplication1/WeatherForecast.cs deleted file mode 100644 index 6514c01..0000000 --- a/ComputerHardwareStore/WebApplication1/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace WebApplication1 -{ - public class WeatherForecast - { - public DateOnly Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} diff --git a/ComputerHardwareStore/WebApplication1/WebApplication1.csproj b/ComputerHardwareStore/WebApplication1/WebApplication1.csproj deleted file mode 100644 index 9daa180..0000000 --- a/ComputerHardwareStore/WebApplication1/WebApplication1.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - diff --git a/ComputerHardwareStore/WebApplication1/WebApplication1.http b/ComputerHardwareStore/WebApplication1/WebApplication1.http deleted file mode 100644 index 1043526..0000000 --- a/ComputerHardwareStore/WebApplication1/WebApplication1.http +++ /dev/null @@ -1,6 +0,0 @@ -@WebApplication1_HostAddress = http://localhost:5174 - -GET {{WebApplication1_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/ComputerHardwareStore/WebApplication1/appsettings.Development.json b/ComputerHardwareStore/WebApplication1/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/ComputerHardwareStore/WebApplication1/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/ComputerHardwareStore/WebApplication1/appsettings.json b/ComputerHardwareStore/WebApplication1/appsettings.json deleted file mode 100644 index 10f68b8..0000000 --- a/ComputerHardwareStore/WebApplication1/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -}