From f7bad7a0bf7d792d1ea2b2969e958485a11d4f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=20=D0=A4=D0=B5=D0=B4=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Sat, 1 Jun 2024 03:37:37 +0400 Subject: [PATCH] fix --- ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs | 2 +- .../ElectronicsShopDataBaseImplement/Models/Order.cs | 2 +- .../ElectronicsShopShopClientApp/Controllers/HomeController.cs | 2 +- .../ElectronicsShopShopClientApp/Views/Home/EditOrder.cshtml | 2 +- .../ElectronicsShopShopClientApp/Views/Home/OrderView.cshtml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs index 247925f..2830f99 100644 --- a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs +++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs @@ -12,7 +12,7 @@ namespace ElectronicsShopDataBaseImplement optionsBuilder) { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-O0N00SH\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs index 3eefb25..8404e5e 100644 --- a/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs +++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/Order.cs @@ -86,7 +86,7 @@ namespace ElectronicsShopDataBaseImplement.Models } context.SaveChanges(); } - var order = context.Orders.First(x => x.ID == model.ID); + var order = context.Orders.FirstOrDefault(x => x.ID == model.ID); order.Sum = model.Sum; foreach (var op in model.ProductList) { context.OrderProducts.Add(new OrderProduct { diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs index 645b955..828265e 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs @@ -135,7 +135,7 @@ namespace ElectronicsShopUserApp.Controllers { } if (id == 0) { - return Redirect("Orders"); + return RedirectToAction("Orders"); } var products = APIClient.GetRequset>>($"api/main/getorderproducts?_orderid={id}"); diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/EditOrder.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/EditOrder.cshtml index fa75e9a..eb068ac 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/EditOrder.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/EditOrder.cshtml @@ -43,7 +43,7 @@ Количество - Сумма + Цена за единицу товара diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/OrderView.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/OrderView.cshtml index 717fadf..b3d3eda 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/OrderView.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/OrderView.cshtml @@ -43,7 +43,7 @@ Количество - Сумма + Цена за единицу товара