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

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

View File

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

View File

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

View File

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

View File

@ -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=5433;Database=Computer_Hardware_Store1;Username=user;Password=12345");
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); 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(); var componentGoods = context.GoodsComponents.Where(x => x.ComponentId == element.Id).ToList();
componentGoods.ForEach(x => 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 != null)
context.Goods.Remove(good); 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.Components.Remove(element);
context.SaveChanges(); context.SaveChanges();

View File

@ -54,10 +54,10 @@
<td> <td>
<div> <div>
<button onclick="getPurchase(@item.Item1.Id)" type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updateModal"> <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>
<button onclick="getPurchase(@item.Item1.Id)" type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteModal"> <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> </button>
</div> </div>

View File

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