вроде работает

This commit is contained in:
Inohara 2023-04-19 19:52:11 +04:00
parent c26ab75741
commit 13f8e6683f
8 changed files with 128 additions and 241 deletions

View File

@ -36,129 +36,72 @@
this.dataGridView = new System.Windows.Forms.DataGridView();
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.мороженоеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.iceCreamComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.iceCreamToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.listShopsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shopWorkloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersByDateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonSupplyShop = new System.Windows.Forms.Button();
this.SellIceCreamButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip.SuspendLayout();
this.SuspendLayout();
buttonUpdate = new Button();
buttonSetToFinish = new Button();
buttonSetToDone = new Button();
buttonSetToWork = new Button();
buttonCreateOrder = new Button();
dataGridView = new DataGridView();
menuStrip = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
компонентыToolStripMenuItem = new ToolStripMenuItem();
мороженоеToolStripMenuItem = new ToolStripMenuItem();
магазиныToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
iceCreamComponentsToolStripMenuItem = new ToolStripMenuItem();
iceCreamToolStripMenuItem = new ToolStripMenuItem();
ordersToolStripMenuItem = new ToolStripMenuItem();
listShopsToolStripMenuItem = new ToolStripMenuItem();
shopWorkloadToolStripMenuItem = new ToolStripMenuItem();
buttonSupplyShop = new Button();
SellIceCreamButton = new Button();
ordersByDateToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
//
// buttonUpdate
//
this.buttonUpdate.Location = new System.Drawing.Point(1067, 390);
this.buttonUpdate.Location = new System.Drawing.Point(1053, 390);
this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(194, 49);
this.buttonUpdate.TabIndex = 13;
this.buttonUpdate.Text = "Обновить";
this.buttonUpdate.UseVisualStyleBackColor = true;
this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
buttonUpdate.Location = new Point(878, 294);
buttonUpdate.Margin = new Padding(3, 2, 3, 2);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(170, 37);
buttonUpdate.TabIndex = 13;
buttonUpdate.Text = "Обновить";
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += buttonUpdate_Click;
//
// buttonSetToFinish
//
this.buttonSetToFinish.Location = new System.Drawing.Point(1067, 298);
this.buttonSetToFinish.Location = new System.Drawing.Point(1053, 193);
this.buttonSetToFinish.Name = "buttonSetToFinish";
this.buttonSetToFinish.Size = new System.Drawing.Size(194, 49);
this.buttonSetToFinish.TabIndex = 12;
this.buttonSetToFinish.Text = "Заказ выдан";
this.buttonSetToFinish.UseVisualStyleBackColor = true;
this.buttonSetToFinish.Click += new System.EventHandler(this.buttonSetToFinish_Click);
buttonSetToFinish.Location = new Point(878, 146);
buttonSetToFinish.Margin = new Padding(3, 2, 3, 2);
buttonSetToFinish.Name = "buttonSetToFinish";
buttonSetToFinish.Size = new Size(170, 37);
buttonSetToFinish.TabIndex = 12;
buttonSetToFinish.Text = "Заказ выдан";
buttonSetToFinish.UseVisualStyleBackColor = true;
buttonSetToFinish.Click += buttonSetToFinish_Click;
//
// buttonSetToDone
//
this.buttonSetToDone.Location = new System.Drawing.Point(1067, 211);
this.buttonSetToDone.Location = new System.Drawing.Point(1053, 139);
this.buttonSetToDone.Name = "buttonSetToDone";
this.buttonSetToDone.Size = new System.Drawing.Size(194, 49);
this.buttonSetToDone.TabIndex = 11;
this.buttonSetToDone.Text = "Заказ готов";
this.buttonSetToDone.UseVisualStyleBackColor = true;
this.buttonSetToDone.Click += new System.EventHandler(this.buttonSetToDone_Click);
buttonSetToDone.Location = new Point(878, 106);
buttonSetToDone.Margin = new Padding(3, 2, 3, 2);
buttonSetToDone.Name = "buttonSetToDone";
buttonSetToDone.Size = new Size(170, 37);
buttonSetToDone.TabIndex = 11;
buttonSetToDone.Text = "Заказ готов";
buttonSetToDone.UseVisualStyleBackColor = true;
buttonSetToDone.Click += buttonSetToDone_Click;
//
// buttonSetToWork
//
this.buttonSetToWork.Location = new System.Drawing.Point(1067, 122);
this.buttonSetToWork.Location = new System.Drawing.Point(1053, 87);
this.buttonSetToWork.Name = "buttonSetToWork";
this.buttonSetToWork.Size = new System.Drawing.Size(194, 49);
this.buttonSetToWork.TabIndex = 10;
this.buttonSetToWork.Text = "Отдать на выполнение";
this.buttonSetToWork.UseVisualStyleBackColor = true;
this.buttonSetToWork.Click += new System.EventHandler(this.buttonSetToWork_Click);
buttonSetToWork.Location = new Point(878, 67);
buttonSetToWork.Margin = new Padding(3, 2, 3, 2);
buttonSetToWork.Name = "buttonSetToWork";
buttonSetToWork.Size = new Size(170, 37);
buttonSetToWork.TabIndex = 10;
buttonSetToWork.Text = "Отдать на выполнение";
buttonSetToWork.UseVisualStyleBackColor = true;
buttonSetToWork.Click += buttonSetToWork_Click;
//
// buttonCreateOrder
//
this.buttonCreateOrder.Location = new System.Drawing.Point(1067, 33);
this.buttonCreateOrder.Location = new System.Drawing.Point(1053, 33);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(194, 49);
this.buttonCreateOrder.TabIndex = 9;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click);
buttonCreateOrder.Location = new Point(878, 26);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(170, 37);
buttonCreateOrder.TabIndex = 9;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += buttonCreateOrder_Click;
//
// dataGridView
//
@ -167,16 +110,8 @@
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(1047, 407);
this.dataGridView.Size = new System.Drawing.Size(1033, 407);
this.dataGridView.TabIndex = 8;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(12, 26);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(848, 305);
dataGridView.TabIndex = 8;
//
// menuStrip
//
@ -187,123 +122,20 @@
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Padding = new System.Windows.Forms.Padding(6, 3, 0, 3);
this.menuStrip.Size = new System.Drawing.Size(1273, 30);
this.menuStrip.Size = new System.Drawing.Size(1259, 30);
this.menuStrip.TabIndex = 7;
this.menuStrip.Text = "Справочники";
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Padding = new Padding(5, 2, 0, 2);
menuStrip.Size = new Size(1102, 24);
menuStrip.TabIndex = 7;
menuStrip.Text = "Справочники";
//
// справочникиToolStripMenuItem
//
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.клиентыToolStripMenuItem,
this.компонентыToolStripMenuItem,
this.мороженоеToolStripMenuItem,
this.клиентыToolStripMenuItem});
this.магазиныToolStripMenuItem});
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
this.справочникиToolStripMenuItem.Text = "Справочники";
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, мороженоеToolStripMenuItem, магазиныToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники";
//
// компонентыToolStripMenuItem
//
компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
компонентыToolStripMenuItem.Size = new Size(145, 22);
компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
//
// мороженоеToolStripMenuItem
//
мороженоеToolStripMenuItem.Name = ороженоеToolStripMenuItem";
мороженоеToolStripMenuItem.Size = new Size(145, 22);
мороженоеToolStripMenuItem.Text = "Мороженое";
мороженоеToolStripMenuItem.Click += мороженоеToolStripMenuItem_Click;
//
// магазиныToolStripMenuItem
//
магазиныToolStripMenuItem.Name = агазиныToolStripMenuItem";
магазиныToolStripMenuItem.Size = new Size(145, 22);
магазиныToolStripMenuItem.Text = "Магазины";
магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { iceCreamComponentsToolStripMenuItem, iceCreamToolStripMenuItem, ordersToolStripMenuItem, listShopsToolStripMenuItem, shopWorkloadToolStripMenuItem, ordersByDateToolStripMenuItem });
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// iceCreamComponentsToolStripMenuItem
//
iceCreamComponentsToolStripMenuItem.Name = "iceCreamComponentsToolStripMenuItem";
iceCreamComponentsToolStripMenuItem.Size = new Size(238, 22);
iceCreamComponentsToolStripMenuItem.Text = "Список мороженых";
iceCreamComponentsToolStripMenuItem.Click += IceCreamsToolStripMenuItem_Click;
//
// iceCreamToolStripMenuItem
//
iceCreamToolStripMenuItem.Name = "iceCreamToolStripMenuItem";
iceCreamToolStripMenuItem.Size = new Size(238, 22);
iceCreamToolStripMenuItem.Text = "Мороженые с компонентами";
iceCreamToolStripMenuItem.Click += IceCreamComponentsToolStripMenuItem_Click;
//
// ordersToolStripMenuItem
//
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(238, 22);
ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
//
// listShopsToolStripMenuItem
//
listShopsToolStripMenuItem.Name = "listShopsToolStripMenuItem";
listShopsToolStripMenuItem.Size = new Size(238, 22);
listShopsToolStripMenuItem.Text = "Список магазинов";
listShopsToolStripMenuItem.Click += listShopsToolStripMenuItem_Click;
//
// shopWorkloadToolStripMenuItem
//
shopWorkloadToolStripMenuItem.Name = "shopWorkloadToolStripMenuItem";
shopWorkloadToolStripMenuItem.Size = new Size(238, 22);
shopWorkloadToolStripMenuItem.Text = "Загруженность магазинов";
shopWorkloadToolStripMenuItem.Click += shopWorkloadToolStripMenuItem_Click;
//
// buttonSupplyShop
//
buttonSupplyShop.Location = new Point(878, 219);
buttonSupplyShop.Margin = new Padding(3, 2, 3, 2);
buttonSupplyShop.Name = "buttonSupplyShop";
buttonSupplyShop.Size = new Size(170, 33);
buttonSupplyShop.TabIndex = 14;
buttonSupplyShop.Text = "Пополнение магазина";
buttonSupplyShop.UseVisualStyleBackColor = true;
buttonSupplyShop.Click += buttonSupplyShop_Click;
//
// SellIceCreamButton
//
SellIceCreamButton.Location = new Point(878, 186);
SellIceCreamButton.Margin = new Padding(3, 2, 3, 2);
SellIceCreamButton.Name = "SellIceCreamButton";
SellIceCreamButton.Size = new Size(170, 30);
SellIceCreamButton.TabIndex = 15;
SellIceCreamButton.Text = "Продажа мороженого";
SellIceCreamButton.UseVisualStyleBackColor = true;
SellIceCreamButton.Click += SellIceCreamButton_Click;
//
// ordersByDateToolStripMenuItem
//
ordersByDateToolStripMenuItem.Name = "ordersByDateToolStripMenuItem";
ordersByDateToolStripMenuItem.Size = new Size(238, 22);
ordersByDateToolStripMenuItem.Text = "Заказы по дате";
ordersByDateToolStripMenuItem.Click += ordersByDateToolStripMenuItem_Click;
//
// клиентыToolStripMenuItem
//
@ -312,11 +144,109 @@
this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
//
// компонентыToolStripMenuItem
//
this.компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.компонентыToolStripMenuItem.Text = "Компоненты";
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.компонентыToolStripMenuItem_Click);
//
// мороженоеToolStripMenuItem
//
this.мороженоеToolStripMenuItem.Name = ороженоеToolStripMenuItem";
this.мороженоеToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.мороженоеToolStripMenuItem.Text = "Мороженое";
this.мороженоеToolStripMenuItem.Click += new System.EventHandler(this.мороженоеToolStripMenuItem_Click);
//
// магазиныToolStripMenuItem
//
this.магазиныToolStripMenuItem.Name = агазиныToolStripMenuItem";
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
this.магазиныToolStripMenuItem.Text = "Магазины";
this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.магазиныToolStripMenuItem_Click);
//
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.iceCreamComponentsToolStripMenuItem,
this.iceCreamToolStripMenuItem,
this.ordersToolStripMenuItem,
this.listShopsToolStripMenuItem,
this.shopWorkloadToolStripMenuItem,
this.ordersByDateToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// iceCreamComponentsToolStripMenuItem
//
this.iceCreamComponentsToolStripMenuItem.Name = "iceCreamComponentsToolStripMenuItem";
this.iceCreamComponentsToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.iceCreamComponentsToolStripMenuItem.Text = "Список мороженых";
this.iceCreamComponentsToolStripMenuItem.Click += new System.EventHandler(this.IceCreamsToolStripMenuItem_Click);
//
// iceCreamToolStripMenuItem
//
this.iceCreamToolStripMenuItem.Name = "iceCreamToolStripMenuItem";
this.iceCreamToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.iceCreamToolStripMenuItem.Text = "Мороженые с компонентами";
this.iceCreamToolStripMenuItem.Click += new System.EventHandler(this.IceCreamComponentsToolStripMenuItem_Click);
//
// ordersToolStripMenuItem
//
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.ordersToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// listShopsToolStripMenuItem
//
this.listShopsToolStripMenuItem.Name = "listShopsToolStripMenuItem";
this.listShopsToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.listShopsToolStripMenuItem.Text = "Список магазинов";
this.listShopsToolStripMenuItem.Click += new System.EventHandler(this.listShopsToolStripMenuItem_Click);
//
// shopWorkloadToolStripMenuItem
//
this.shopWorkloadToolStripMenuItem.Name = "shopWorkloadToolStripMenuItem";
this.shopWorkloadToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.shopWorkloadToolStripMenuItem.Text = "Загруженность магазинов";
this.shopWorkloadToolStripMenuItem.Click += new System.EventHandler(this.shopWorkloadToolStripMenuItem_Click);
//
// ordersByDateToolStripMenuItem
//
this.ordersByDateToolStripMenuItem.Name = "ordersByDateToolStripMenuItem";
this.ordersByDateToolStripMenuItem.Size = new System.Drawing.Size(299, 26);
this.ordersByDateToolStripMenuItem.Text = "Заказы по дате";
this.ordersByDateToolStripMenuItem.Click += new System.EventHandler(this.ordersByDateToolStripMenuItem_Click);
//
// buttonSupplyShop
//
this.buttonSupplyShop.Location = new System.Drawing.Point(1053, 290);
this.buttonSupplyShop.Name = "buttonSupplyShop";
this.buttonSupplyShop.Size = new System.Drawing.Size(194, 44);
this.buttonSupplyShop.TabIndex = 14;
this.buttonSupplyShop.Text = "Пополнение магазина";
this.buttonSupplyShop.UseVisualStyleBackColor = true;
this.buttonSupplyShop.Click += new System.EventHandler(this.buttonSupplyShop_Click);
//
// SellIceCreamButton
//
this.SellIceCreamButton.Location = new System.Drawing.Point(1053, 246);
this.SellIceCreamButton.Name = "SellIceCreamButton";
this.SellIceCreamButton.Size = new System.Drawing.Size(194, 40);
this.SellIceCreamButton.TabIndex = 15;
this.SellIceCreamButton.Text = "Продажа мороженого";
this.SellIceCreamButton.UseVisualStyleBackColor = true;
this.SellIceCreamButton.Click += new System.EventHandler(this.SellIceCreamButton_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1273, 463);
this.ClientSize = new System.Drawing.Size(1259, 467);
this.Controls.Add(this.SellIceCreamButton);
this.Controls.Add(this.buttonSupplyShop);
this.Controls.Add(this.buttonUpdate);
this.Controls.Add(this.buttonSetToFinish);
this.Controls.Add(this.buttonSetToDone);
@ -324,7 +254,7 @@
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip);
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.Name = "FormMain";
this.Text = "Магазин мороженого";
this.Load += new System.EventHandler(this.FormMain_Load);
@ -334,26 +264,6 @@
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1102, 350);
Controls.Add(SellIceCreamButton);
Controls.Add(buttonSupplyShop);
Controls.Add(buttonUpdate);
Controls.Add(buttonSetToFinish);
Controls.Add(buttonSetToDone);
Controls.Add(buttonSetToWork);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip);
Name = "FormMain";
Text = "Магазин мороженого";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion

View File

@ -124,7 +124,7 @@ namespace IceCreamShopApp.Controllers
}
[HttpPost]
public void Update(int shop, string name, string address, DateTime date, int count)
public void Update(int shop, string name, string adress, DateTime date, int count)
{
if (APIClient.Access == false)
{
@ -134,7 +134,7 @@ namespace IceCreamShopApp.Controllers
{
throw new Exception("Название магазина не может быть пустым");
}
if (string.IsNullOrEmpty(address))
if (string.IsNullOrEmpty(adress))
{
throw new Exception("Адрес магазина не может быть пустым");
}
@ -146,7 +146,7 @@ namespace IceCreamShopApp.Controllers
{
Id = shop,
Name = name,
Adress = address,
Adress = adress,
OpeningDate = date,
IceCreamMaxCount = count
});
@ -185,7 +185,7 @@ namespace IceCreamShopApp.Controllers
return Redirect("~/Home/Enter");
}
ViewBag.Shops = APIClient.GetRequest<List<ShopViewModel>>("api/shop/getshops");
ViewBag.ListIceCream = APIClient.GetRequest<List<IceCreamViewModel>>("api/main/getlisticecream");
ViewBag.ListIceCream = APIClient.GetRequest<List<IceCreamViewModel>>("api/main/GetIceCreamList");
return View();
}

View File

@ -15,7 +15,7 @@
<div class="row">
<div class="col-4">Магазин:</div>
<div class="col-8">
<select id="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "ShopName"))"></select>
<select id="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "Name"))"></select>
</div>
</div>
<div class="row">

View File

@ -8,7 +8,7 @@
<div class="row">
<div class="col-4">Магазин:</div>
<div class="col-8">
<select id="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "ShopName"))"></select>
<select id="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "Name"))"></select>
</div>
</div>
<div class="row">

View File

@ -12,7 +12,7 @@
<div class="row">
<div class="col-4">Магазин:</div>
<div class="col-8">
<select id="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "ShopName"))"></select>
<select id="shop" name="shop" class="form-control" asp-items="@(new SelectList(@ViewBag.Shops, "Id", "Name"))"></select>
</div>
</div>
<div class="row">
@ -65,9 +65,9 @@
url: "/Home/GetShop",
data: { shopId: shop },
success: function (result) {
$('#name').val(result.item1.shopName);
$('#name').val(result.item1.name);
$('#adress').val(result.item1.adress);
$('#date').val(result.item1.dateOpening);
$('#date').val(result.item1.openingDate);
$('#count').val(result.item1.iceCreamMaxCount);
$('#table-elements').html(result.item2);
}

View File

@ -99,7 +99,7 @@ namespace IceCreamShopDatabaseImplement.Implements
return null;
}
shop.Update(model);
shop.UpdatePastries(context, model);
shop.UpdateIceCreams(context, model);
context.SaveChanges();
return shop.GetViewModel;
}

View File

@ -82,8 +82,9 @@ namespace IceCreamShopDatabaseImplement.Models
IceCreamMaxCount = IceCreamMaxCount,
};
public void UpdatePastries(IceCreamShopDatabase context, ShopBindingModel model)
public void UpdateIceCreams(IceCreamShopDatabase context, ShopBindingModel model)
{
if (model.ShopIceCreams == null) return;
var iceCreams = context.ShopIcecreams.Where(rec => rec.ShopId == model.Id).ToList();
if (iceCreams != null && iceCreams.Count > 0)
{

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Shops>
<Shop Id="1">
<Name>small</Name>
<Adress>string</Adress>
<OpeningDate>2023-04-12T09:20:34.333Z</OpeningDate>
<IceCreamMaxCount>4</IceCreamMaxCount>
<ShopIceCreams />
</Shop>
<Shop Id="2">
<Name>small</Name>
<Adress>string</Adress>
<OpeningDate>2023-04-12T09:20:34.333Z</OpeningDate>
<IceCreamMaxCount>4</IceCreamMaxCount>
<ShopIceCreams />
</Shop>
<Shop Id="3">
<Name>asd</Name>
<Adress>asd</Adress>
<OpeningDate>2023-04-07T00:00:00</OpeningDate>
<IceCreamMaxCount>4</IceCreamMaxCount>
<ShopIceCreams />
</Shop>
</Shops>