diff --git a/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs b/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs index 36bfb0d..ba1c28d 100644 --- a/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs +++ b/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs @@ -10,7 +10,7 @@ namespace HardwareShopDatabaseImplement { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - optionsBuilder.UseNpgsql("Host=localhost;Port=5433;Database=Computer_Hardware_Store;Username=user;Password=12345"); + optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=Computer_Hardware_Store;Username=postgres;Password=1234"); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); } diff --git a/HardwareShop/HardwareShopRestApi/Program.cs b/HardwareShop/HardwareShopRestApi/Program.cs index 0139832..6053db8 100644 --- a/HardwareShop/HardwareShopRestApi/Program.cs +++ b/HardwareShop/HardwareShopRestApi/Program.cs @@ -35,7 +35,7 @@ builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(c => { - c.SwaggerDoc("v1", new OpenApiInfo { Title = "SushiBarRestApi", Version = "v1" }); + c.SwaggerDoc("v1", new OpenApiInfo { Title = "HardwareShopRestApi", Version = "v1" }); }); var app = builder.Build(); diff --git a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs index 5f9f0a2..6970d98 100644 --- a/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs +++ b/HardwareShop/HardwareShopWorkerApp/Controllers/HomeController.cs @@ -22,13 +22,21 @@ namespace HardwareShopWorkerApp.Controllers } [HttpPost] - public void Register(string login, string email, string password, int role) + public void Register(string login, string email, string password) { - if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password) || role <= 0) + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) { - throw new Exception("Введите логин, email, пароль и роль"); + throw new Exception("Введите логин, email, пароль"); } + APIClient.PostRequest("api/client/register", new UserBindingModel + { + Login = login, + Email = email, + Password = password, + Role = UserRole.Работник, + }); Response.Redirect("Enter"); + return; } public IActionResult Index() diff --git a/HardwareShop/HardwareShopWorkerApp/HardwareShopWorkerApp.csproj b/HardwareShop/HardwareShopWorkerApp/HardwareShopWorkerApp.csproj index 39a8038..003939b 100644 --- a/HardwareShop/HardwareShopWorkerApp/HardwareShopWorkerApp.csproj +++ b/HardwareShop/HardwareShopWorkerApp/HardwareShopWorkerApp.csproj @@ -23,6 +23,7 @@ + diff --git a/HardwareShop/HardwareShopWorkerApp/appsettings.json b/HardwareShop/HardwareShopWorkerApp/appsettings.json index 6d1c8cd..8685b00 100644 --- a/HardwareShop/HardwareShopWorkerApp/appsettings.json +++ b/HardwareShop/HardwareShopWorkerApp/appsettings.json @@ -7,5 +7,5 @@ }, "AllowedHosts": "*", - "IPAddress": "http://localhost:5008/" + "IPAddress": "http://localhost:5254/" }