diff --git a/HardwareShop/HardwareShopClientApp/Controllers/HomeController.cs b/HardwareShop/HardwareShopClientApp/Controllers/HomeController.cs index bc76ab8..b89dca1 100644 --- a/HardwareShop/HardwareShopClientApp/Controllers/HomeController.cs +++ b/HardwareShop/HardwareShopClientApp/Controllers/HomeController.cs @@ -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)] diff --git a/HardwareShop/HardwareShopClientApp/Views/Home/Privacy.cshtml b/HardwareShop/HardwareShopClientApp/Views/Home/Privacy.cshtml index 1984ba8..2659243 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Home/Privacy.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Home/Privacy.cshtml @@ -5,7 +5,7 @@ @{ ViewData["Title"] = "Privacy Policy"; - Layout = "~/Views/Shared/_LayoutWorker.cshtml"; + Layout = "~/Views/Shared/_LayoutStorekeeper.cshtml"; }

Личные данные

diff --git a/HardwareShop/HardwareShopClientApp/Views/Home/Register.cshtml b/HardwareShop/HardwareShopClientApp/Views/Home/Register.cshtml index b0e0192..bb7a407 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Home/Register.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Home/Register.cshtml @@ -17,14 +17,14 @@

Регистрация

-
- - -
+
+ + +
diff --git a/HardwareShop/HardwareShopClientApp/Views/Shared/_LayoutStorekeeper.cshtml b/HardwareShop/HardwareShopClientApp/Views/Shared/_LayoutStorekeeper.cshtml index b9a3b55..df48df6 100644 --- a/HardwareShop/HardwareShopClientApp/Views/Shared/_LayoutStorekeeper.cshtml +++ b/HardwareShop/HardwareShopClientApp/Views/Shared/_LayoutStorekeeper.cshtml @@ -35,6 +35,9 @@ +
diff --git a/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs b/HardwareShop/HardwareShopDatabaseImplement/HardwareShopDatabase.cs index 36bfb0d..af8e862 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=5433;Database=Computer_Hardware_Store1;Username=user;Password=12345"); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); } diff --git a/HardwareShop/HardwareShopDatabaseImplement/Implements/Storekeeper/ComponentStorage.cs b/HardwareShop/HardwareShopDatabaseImplement/Implements/Storekeeper/ComponentStorage.cs index 129488b..d23d75b 100644 --- a/HardwareShop/HardwareShopDatabaseImplement/Implements/Storekeeper/ComponentStorage.cs +++ b/HardwareShop/HardwareShopDatabaseImplement/Implements/Storekeeper/ComponentStorage.cs @@ -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) - 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.SaveChanges(); diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml index 7c8bad6..9730923 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/LinkPurchase.cshtml @@ -54,10 +54,10 @@
diff --git a/HardwareShop/HardwareShopWorkerApp/Views/Home/Register.cshtml b/HardwareShop/HardwareShopWorkerApp/Views/Home/Register.cshtml index b0e0192..bb7a407 100644 --- a/HardwareShop/HardwareShopWorkerApp/Views/Home/Register.cshtml +++ b/HardwareShop/HardwareShopWorkerApp/Views/Home/Register.cshtml @@ -17,14 +17,14 @@

Регистрация

-
- - -
+
+ + +