КОЛЯ ДЕРЖИ ИЗМЕНЕНИЯ КАК ТЫ И ПРОСИЛ

This commit is contained in:
dasha 2023-05-19 17:30:44 +04:00
parent 60c507bb4b
commit 6f449c505b
8 changed files with 25 additions and 16 deletions

View File

@ -55,7 +55,7 @@ namespace HardwareShopStorekeeperApp.Controllers
}
[HttpPost]
public void Privacy(string login, string email, string password)
public IActionResult Privacy(string login, string email, string password)
{
if (APIClient.User == null)
{
@ -77,7 +77,7 @@ namespace HardwareShopStorekeeperApp.Controllers
APIClient.User.Email = email;
APIClient.User.Password = password;
RedirectToAction("MainStorekeeper", "Storekeeper");
return RedirectToAction("MainStorekeeper", "Storekeeper");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]

View File

@ -5,7 +5,7 @@
@{
ViewData["Title"] = "Privacy Policy";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
Layout = "~/Views/Shared/_LayoutStorekeeper.cshtml";
}
<div class="text-center">
<h2 class="display-4">Личные данные</h2>

View File

@ -17,14 +17,14 @@
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post" class="d-flex flex-column align-items-center">
<div class="col-sm-3">
<label class="form-label">Логин</label>
<input type="text" class="form-control" aria-describedby="emailHelp" name="login">
</div>
<div class="col-sm-3">
<label class="form-label">Почта</label>
<input type="text" class="form-control" name="email">
</div>
<div class="col-sm-3">
<label class="form-label">Логин</label>
<input type="text" class="form-control" aria-describedby="emailHelp" name="login">
</div>
<div class="col-sm-3">
<label class="form-label">Пароль</label>
<input type="password" class="form-control" name="password">

View File

@ -35,6 +35,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Storekeeper" asp-action="Report">Отчёт</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
</ul>
</div>
</div>

View File

@ -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=5433;Database=Computer_Hardware_Store1;Username=user;Password=12345");
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
}

View File

@ -21,9 +21,15 @@ namespace HardwareShopDatabaseImplement.Implements.Storekeeper
var componentGoods = context.GoodsComponents.Where(x => x.ComponentId == element.Id).ToList();
componentGoods.ForEach(x =>
{
var good = context.Goods.FirstOrDefault(rec => rec.Id == x.GoodId);
var good = context.Goods.Include(x => x.Components).FirstOrDefault(rec => rec.Id == x.GoodId);
if (good != null)
if (good.GoodComponents.Count == 1)
context.Goods.Remove(good);
else
{
good.Price -= element.Cost * x.Count;
good.Price = Math.Round(good.Price, 2);
}
});
context.Components.Remove(element);
context.SaveChanges();

View File

@ -54,10 +54,10 @@
<td>
<div>
<button onclick="getPurchase(@item.Item1.Id)" type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updateModal">
Изменить
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
<button onclick="getPurchase(@item.Item1.Id)" type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">
Удалить
<i class="fa fa-trash" aria-hidden="true"></i>
</button>
</div>

View File

@ -17,14 +17,14 @@
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post" class="d-flex flex-column align-items-center">
<div class="col-sm-3">
<label class="form-label">Логин</label>
<input type="text" class="form-control" aria-describedby="emailHelp" name="login">
</div>
<div class="col-sm-3">
<label class="form-label">Почта</label>
<input type="text" class="form-control" name="email">
</div>
<div class="col-sm-3">
<label class="form-label">Логин</label>
<input type="text" class="form-control" aria-describedby="emailHelp" name="login">
</div>
<div class="col-sm-3">
<label class="form-label">Пароль</label>
<input type="password" class="form-control" name="password">