diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs index 70722c8..0ed15ea 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormClients.cs @@ -45,7 +45,6 @@ namespace BlacksmithWorkshop if (list != null) { dataGridView.DataSource = list; - dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs index d1f91e1..6783697 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs @@ -55,12 +55,12 @@ dataGridView.Name = "dataGridView"; dataGridView.RowHeadersWidth = 51; dataGridView.RowTemplate.Height = 29; - dataGridView.Size = new Size(937, 402); + dataGridView.Size = new Size(1209, 402); dataGridView.TabIndex = 0; // // buttonCreateOrder // - buttonCreateOrder.Location = new Point(1014, 66); + buttonCreateOrder.Location = new Point(1247, 70); buttonCreateOrder.Name = "buttonCreateOrder"; buttonCreateOrder.Size = new Size(235, 29); buttonCreateOrder.TabIndex = 1; @@ -70,7 +70,7 @@ // // buttonTakeOrderInWork // - buttonTakeOrderInWork.Location = new Point(1014, 143); + buttonTakeOrderInWork.Location = new Point(1247, 147); buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Size = new Size(235, 29); buttonTakeOrderInWork.TabIndex = 2; @@ -80,7 +80,7 @@ // // buttonOrderReady // - buttonOrderReady.Location = new Point(1014, 220); + buttonOrderReady.Location = new Point(1247, 224); buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Size = new Size(235, 29); buttonOrderReady.TabIndex = 3; @@ -90,7 +90,7 @@ // // buttonIssuedOrder // - buttonIssuedOrder.Location = new Point(1014, 296); + buttonIssuedOrder.Location = new Point(1247, 300); buttonIssuedOrder.Name = "buttonIssuedOrder"; buttonIssuedOrder.Size = new Size(235, 29); buttonIssuedOrder.TabIndex = 4; @@ -100,7 +100,7 @@ // // buttonRef // - buttonRef.Location = new Point(1014, 369); + buttonRef.Location = new Point(1247, 373); buttonRef.Name = "buttonRef"; buttonRef.Size = new Size(235, 29); buttonRef.TabIndex = 5; @@ -114,7 +114,7 @@ menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, reportsToolStripMenuItem, workWithClientsToolStripMenuItem }); menuStrip.Location = new Point(0, 0); menuStrip.Name = "menuStrip"; - menuStrip.Size = new Size(1297, 28); + menuStrip.Size = new Size(1506, 28); menuStrip.TabIndex = 6; menuStrip.Text = "menuStrip1"; // @@ -177,7 +177,7 @@ // clientsToolStripMenuItem // clientsToolStripMenuItem.Name = "clientsToolStripMenuItem"; - clientsToolStripMenuItem.Size = new Size(224, 26); + clientsToolStripMenuItem.Size = new Size(152, 26); clientsToolStripMenuItem.Text = "Клиенты"; clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; // @@ -185,7 +185,7 @@ // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1297, 450); + ClientSize = new Size(1506, 450); Controls.Add(buttonRef); Controls.Add(buttonIssuedOrder); Controls.Add(buttonOrderReady); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index bd1ba9e..e8058df 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -49,7 +49,9 @@ namespace BlacksmithWorkshop { dataGridView.DataSource = list; dataGridView.Columns["ManufactureId"].Visible = false; + dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["ManufactureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка заказов"); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs index b45b481..e81cd6d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Controllers/HomeController.cs @@ -169,10 +169,10 @@ namespace BlacksmithWorkshopClientApp.Controllers [HttpPost] public double Calc(int count, int manufacture) { - var prod =APIClient.GetRequest($"api/main/getmanufacture?manufactureId={manufacture}" + var manuf =APIClient.GetRequest($"api/main/getmanufacture?manufactureId={manufacture}" ); - return count * (prod?.Price ?? 1); + return count * (manuf?.Price ?? 1); } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs index 0727468..04eb63a 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Program.cs @@ -1,3 +1,5 @@ +using BlacksmithWorkshopClientApp; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -5,6 +7,8 @@ builder.Services.AddControllersWithViews(); var app = builder.Build(); +APIClient.Connect(builder.Configuration); + // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml index 5841849..2d60b8f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml +++ b/BlacksmithWorkshop/BlacksmithWorkshopClientApp/Views/Home/Create.cshtml @@ -9,7 +9,7 @@
Изделие:
- +
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs index 4cf0e4d..3c1f16b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs @@ -19,8 +19,6 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements using var context = new BlacksmithWorkshopDatabase(); var element = context.Orders - .Include(x => x.Manufacture) - .Include(x => x.Client) .FirstOrDefault(rec => rec.Id == model.Id); if (element != null) @@ -28,8 +26,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements // для отображения КОРРЕКТНОЙ ViewModel-и var deletedElement = context.Orders .Include(x => x.Manufacture) - .Include(x => x.Client) - .FirstOrDefault(x => x.Id == model.Id) + .Include(x => x.Client) + .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; context.Orders.Remove(element); @@ -75,26 +73,13 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements .Select(x => x.GetViewModel) .ToList(); } - else if (model.Id.HasValue) - { - return context.Orders - .Include(x => x.Manufacture) - .Include(x => x.Client) - .Where(x => x.Id == model.Id) - .Select(x => x.GetViewModel) - .ToList(); - } - else if(model.ClientId.HasValue) - { - return context.Orders - .Include(x => x.Manufacture) - .Include(x => x.Client) - .Where(x => x.ClientId == model.ClientId) - .Select(x => x.GetViewModel) - .ToList(); - } - return new(); + return context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); } public List GetFullList() @@ -103,8 +88,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) - .Include(x => x.Client) - .Select(x => x.GetViewModel) + .Include(x => x.Client) + .Select(x => x.GetViewModel) .ToList(); } @@ -137,7 +122,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements .Include(x => x.Client) .FirstOrDefault(x => x.Id == model.Id); - if (order == null) + if (order == null) { return null; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs index b61e409..a39b1ca 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs @@ -83,7 +83,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Models Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, - ManufactureName = Manufacture.ManufactureName - }; + ManufactureName = Manufacture.ManufactureName, + ClientFIO = Client.ClientFIO + }; } }