попытки фиксить регистрацию
This commit is contained in:
parent
b0ea2fb11e
commit
f6c5157c5d
@ -10,7 +10,7 @@ namespace HardwareShopDatabaseImplement
|
|||||||
{
|
{
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
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);
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ builder.Services.AddControllers();
|
|||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(c =>
|
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();
|
var app = builder.Build();
|
||||||
|
@ -22,13 +22,21 @@ namespace HardwareShopWorkerApp.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[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");
|
Response.Redirect("Enter");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<ProjectReference Include="..\HardwareShopBusinessLogic\HardwareShopBusinessLogic.csproj" />
|
<ProjectReference Include="..\HardwareShopBusinessLogic\HardwareShopBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\HardwareShopContracts\HardwareShopContracts.csproj" />
|
<ProjectReference Include="..\HardwareShopContracts\HardwareShopContracts.csproj" />
|
||||||
<ProjectReference Include="..\HardwareShopDatabaseImplement\HardwareShopDatabaseImplement.csproj" />
|
<ProjectReference Include="..\HardwareShopDatabaseImplement\HardwareShopDatabaseImplement.csproj" />
|
||||||
|
<ProjectReference Include="..\HardwareShopDataModels\HardwareShopDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
"IPAddress": "http://localhost:5008/"
|
"IPAddress": "http://localhost:5254/"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user