diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs index 2830f99..247925f 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-O0N00SH\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs index 81c7501..645b955 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Controllers/HomeController.cs @@ -232,6 +232,53 @@ namespace ElectronicsShopUserApp.Controllers { { //ViewBag.Reports = APIClient.GetRequset>($"api/main/getproducts"); return View(); + } + public IActionResult Payment(int id) + { + if (APIClient.Client == null) + { + return Redirect("~/Home/Enter"); + } + + if (id == 0) + { + return Redirect("Orders"); + } + var products = APIClient.GetRequset>>($"api/main/getorderproducts?_orderid={id}"); + + foreach (var pr in products) + { + var product = JsonConvert.DeserializeObject(pr[0]); + int count = JsonConvert.DeserializeObject(pr[1]); + _productList.Add(product.ID, (product, count)); + } + + (int, Dictionary) tuple = (id, _productList); + return View(tuple); + } + [HttpGet] + public IActionResult PaymentProduct(int id) + { + if (APIClient.Client == null) + { + return Redirect("~/Home/Enter"); + } + + if (id == 0) + { + return Redirect("Orders"); + } + var products = APIClient.GetRequset>>($"api/main/getorderproducts?_orderid={id}"); + + foreach (var pr in products) + { + var product = JsonConvert.DeserializeObject(pr[0]); + int count = JsonConvert.DeserializeObject(pr[1]); + _productList.Add(product.ID, (product, count)); + } + + (int, Dictionary) tuple = (id, _productList); + return View(tuple); } } } diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Orders.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Orders.cshtml index 0654f8a..e03913b 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Orders.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Orders.cshtml @@ -48,6 +48,7 @@ @Html.DisplayFor(modelItem => item.Sum) + Оплатить Изменить Удалить diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Payment.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Payment.cshtml new file mode 100644 index 0000000..88b9e1d --- /dev/null +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Payment.cshtml @@ -0,0 +1,72 @@ +@using ElectronicsShopContracts.ViewModels +@using ElectronicsShopDataModels.Models + +@model (int, Dictionary) + +@{ + ViewData["Title"] = "Payment"; +} + +
+

Оплата корзины

+
+ +
+
+
+
+ +
+
+
+ + + + + + + + + + + @foreach (var item in Model.Item2) + { + + + + + + + + + + + } + +
+ Номер + + Продукт + + Количество + + Сумма +
+ @Html.DisplayFor(modelItem => item.Key) + + @Html.DisplayFor(modelItem => item.Value.Item1.ProductName) + + @Html.DisplayFor(modelItem => item.Value.Item2) + + @Html.DisplayFor(modelItem => item.Value.Item1.Price) + + Оплатить +
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/PaymentProduct.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/PaymentProduct.cshtml new file mode 100644 index 0000000..75877f4 --- /dev/null +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/PaymentProduct.cshtml @@ -0,0 +1,26 @@ +@{ + ViewData["Title"] = "AddProduct"; +} +
+

Оплата продукта

+
+
+
+
Продукты:
+
+ +
+
+
+
Сумма:
+
+ +
+
+
+
+
+ +
+
+