From 68ce43d50a6bee81eac6ed187b06c7342a4c01dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D1=8F=D1=80=20=D0=90=D0=B3=D0=BB?= =?UTF-8?q?=D0=B8=D1=83=D0=BB=D0=BB=D0=BE=D0=B2?= Date: Wed, 1 Mar 2023 20:55:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=B4=D0=B5=D0=BB=D0=B8=D0=B9=20=D0=B2=20=D1=84=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=B0=D1=82=D0=B5=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfectionaryBusinessLogic/ComponentLogic.cs | 6 +- .../OfficePackage/AbstractSaveToExcel.cs | 4 +- ConfectionaryBusinessLogic/ReportLogic.cs | 22 ++-- ConfectionaryFileImplement/Component.cs | 6 +- .../DataFileSingleton.cs | 6 +- Confectionery/FormComponents.cs | 2 +- Confectionery/FormMain.Designer.cs | 8 +- Confectionery/FormPastry.Designer.cs | 4 +- Confectionery/FormPastry.cs | 6 +- Confectionery/FormPastryComponent.cs | 2 +- .../FormReportPastryComponents.Designer.cs | 121 +++++++++--------- Confectionery/FormReportPastryComponents.cs | 4 +- Confectionery/FormReportPastryComponents.resx | 62 +-------- .../ReportPastryComponentViewModel.cs | 4 +- .../20230219142123_InitialCreate.Designer.cs | 12 +- .../20230219142123_InitialCreate.cs | 8 +- .../ConfectioneryDatabaseModelSnapshot.cs | 12 +- 17 files changed, 114 insertions(+), 175 deletions(-) diff --git a/ConfectionaryBusinessLogic/ComponentLogic.cs b/ConfectionaryBusinessLogic/ComponentLogic.cs index 27e25ab..8e0237a 100644 --- a/ConfectionaryBusinessLogic/ComponentLogic.cs +++ b/ConfectionaryBusinessLogic/ComponentLogic.cs @@ -18,7 +18,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics } public List? ReadList(ComponentSearchModel? model) { - _logger.LogInformation("ReadList. ComponentName:{ComponentName}.Id:{ Id} ", + _logger.LogInformation("ReadList. PastryName:{PastryName}.Id:{ Id} ", model?.ComponentName, model?.Id); var list = (model == null) ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model); @@ -36,7 +36,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics { throw new ArgumentNullException(nameof(model)); } - _logger.LogInformation("ReadElement. ComponentName:{ComponentName}.Id:{ Id}", + _logger.LogInformation("ReadElement. PastryName:{PastryName}.Id:{ Id}", model.ComponentName, model.Id); var element = _componentStorage.GetElement(model); if (element == null) @@ -98,7 +98,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics { throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost)); } - _logger.LogInformation("Component. ComponentName:{ComponentName}.Cost:{ Cost}. Id: { Id}", + _logger.LogInformation("Components. PastryName:{PastryName}.Cost:{ Cost}. Id: { Id}", model.ComponentName, model.Cost, model.Id); var element = _componentStorage.GetElement(new ComponentSearchModel { diff --git a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 8ffc497..ee68173 100644 --- a/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/ConfectionaryBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -39,12 +39,12 @@ namespace ConfectioneryBusinessLogic.OfficePackage { ColumnName = "A", RowIndex = rowIndex, - Text = pc.ComponentName, + Text = pc.PastryName, StyleInfo = ExcelStyleInfoType.Text }); rowIndex++; - foreach (var (Pastry, Count) in pc.Pastries) + foreach (var (Pastry, Count) in pc.Components) { InsertCellInWorksheet(new ExcelCellParameters { diff --git a/ConfectionaryBusinessLogic/ReportLogic.cs b/ConfectionaryBusinessLogic/ReportLogic.cs index eb7d8b4..68a557f 100644 --- a/ConfectionaryBusinessLogic/ReportLogic.cs +++ b/ConfectionaryBusinessLogic/ReportLogic.cs @@ -47,24 +47,24 @@ namespace ConfectioneryBusinessLogic { var components = _componentStorage.GetFullList(); - var Pastrys = _pastryStorage.GetFullList(); + var pastries = _pastryStorage.GetFullList(); var list = new List(); - foreach (var component in components) + foreach (var pastry in pastries) { var record = new ReportPastryComponentViewModel { - ComponentName = component.ComponentName, - Pastries = new List>(), + PastryName = pastry.PastryName, + Components = new List>(), TotalCount = 0 }; - foreach (var Pastry in Pastrys) + foreach (var component in components) { - if (Pastry.PastryComponents.ContainsKey(component.Id)) + if (pastry.PastryComponents.ContainsKey(component.Id)) { - record.Pastries.Add(new(Pastry.PastryName, Pastry.PastryComponents[component.Id].Item2)); - record.TotalCount += Pastry.PastryComponents[component.Id].Item2; + record.Components.Add(new(component.ComponentName, pastry.PastryComponents[component.Id].Item2)); + record.TotalCount += pastry.PastryComponents[component.Id].Item2; } } @@ -93,7 +93,7 @@ namespace ConfectioneryBusinessLogic } /// - /// Сохранение компонент в файл-Word + /// Сохранение изделий в файл-Word /// /// public void SavePastriesToWordFile(ReportBindingModel model) @@ -107,7 +107,7 @@ namespace ConfectioneryBusinessLogic } /// - /// Сохранение компонент с указаеним продуктов в файл-Excel + /// Сохранение изделий с указаеним продуктов в файл-Excel /// /// public void SavePastryComponentToExcelFile(ReportBindingModel model) @@ -115,7 +115,7 @@ namespace ConfectioneryBusinessLogic _saveToExcel.CreateReport(new ExcelInfo { FileName = model.FileName, - Title = "Список компонент", + Title = "Список изделий", PastryComponents = GetPastryComponent() }); } diff --git a/ConfectionaryFileImplement/Component.cs b/ConfectionaryFileImplement/Component.cs index 91da900..e5adaa5 100644 --- a/ConfectionaryFileImplement/Component.cs +++ b/ConfectionaryFileImplement/Component.cs @@ -33,7 +33,7 @@ namespace ConfectioneryFileImplement.Models return new Component() { Id = Convert.ToInt32(element.Attribute("Id")!.Value), - ComponentName = element.Element("ComponentName")!.Value, + ComponentName = element.Element("PastryName")!.Value, Cost = Convert.ToDouble(element.Element("Cost")!.Value) }; } @@ -52,9 +52,9 @@ namespace ConfectioneryFileImplement.Models ComponentName = ComponentName, Cost = Cost }; - public XElement GetXElement => new("Component", + public XElement GetXElement => new("Components", new XAttribute("Id", Id), - new XElement("ComponentName", ComponentName), + new XElement("PastryName", ComponentName), new XElement("Cost", Cost.ToString())); } } \ No newline at end of file diff --git a/ConfectionaryFileImplement/DataFileSingleton.cs b/ConfectionaryFileImplement/DataFileSingleton.cs index ff056a2..19bce37 100644 --- a/ConfectionaryFileImplement/DataFileSingleton.cs +++ b/ConfectionaryFileImplement/DataFileSingleton.cs @@ -6,7 +6,7 @@ namespace ConfectioneryFileImplement public class DataFileSingleton { private static DataFileSingleton? instance; - private readonly string ComponentFileName = "Component.xml"; + private readonly string ComponentFileName = "Components.xml"; private readonly string OrderFileName = "Order.xml"; private readonly string PastryFileName = "Pastry.xml"; public List Components { get; private set; } @@ -22,12 +22,12 @@ namespace ConfectioneryFileImplement return instance; } public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement); - public void SavePastries() => SaveData(Pastries, PastryFileName, "Pastries", x => x.GetXElement); + public void SavePastries() => SaveData(Pastries, PastryFileName, "Components", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); private DataFileSingleton() { - Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; + Components = LoadData(ComponentFileName, "Components", x => Component.Create(x)!)!; Pastries = LoadData(PastryFileName, "Pastry", x => Pastry.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; } diff --git a/Confectionery/FormComponents.cs b/Confectionery/FormComponents.cs index 2f20d12..54d32f5 100644 --- a/Confectionery/FormComponents.cs +++ b/Confectionery/FormComponents.cs @@ -27,7 +27,7 @@ namespace ConfectioneryView { dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; - dataGridView.Columns["ComponentName"].AutoSizeMode = + dataGridView.Columns["PastryName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка компонентов"); diff --git a/Confectionery/FormMain.Designer.cs b/Confectionery/FormMain.Designer.cs index 4ba23b3..f218479 100644 --- a/Confectionery/FormMain.Designer.cs +++ b/Confectionery/FormMain.Designer.cs @@ -86,21 +86,21 @@ // pastriesToolStripMenuItem // pastriesToolStripMenuItem.Name = "pastriesToolStripMenuItem"; - pastriesToolStripMenuItem.Size = new Size(218, 22); + pastriesToolStripMenuItem.Size = new Size(215, 22); pastriesToolStripMenuItem.Text = "Список изделий"; pastriesToolStripMenuItem.Click += PastriesToolStripMenuItem_Click_1; // // pastryComponentsToolStripMenuItem // pastryComponentsToolStripMenuItem.Name = "pastryComponentsToolStripMenuItem"; - pastryComponentsToolStripMenuItem.Size = new Size(218, 22); - pastryComponentsToolStripMenuItem.Text = "Компоненты по изделиям"; + pastryComponentsToolStripMenuItem.Size = new Size(215, 22); + pastryComponentsToolStripMenuItem.Text = "Изделия с компонентами"; pastryComponentsToolStripMenuItem.Click += PastryComponentsToolStripMenuItem_Click; // // ordersToolStripMenuItem // ordersToolStripMenuItem.Name = "ordersToolStripMenuItem"; - ordersToolStripMenuItem.Size = new Size(218, 22); + ordersToolStripMenuItem.Size = new Size(215, 22); ordersToolStripMenuItem.Text = "Список заказов"; ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click; // diff --git a/Confectionery/FormPastry.Designer.cs b/Confectionery/FormPastry.Designer.cs index 1c6ecaf..cdd39b4 100644 --- a/Confectionery/FormPastry.Designer.cs +++ b/Confectionery/FormPastry.Designer.cs @@ -144,12 +144,12 @@ this.id.Name = "id"; this.id.Visible = false; // - // Component + // Components // this.Component.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.Component.FillWeight = 1000F; this.Component.HeaderText = "Компонент"; - this.Component.Name = "Component"; + this.Component.Name = "Components"; // // Count // diff --git a/Confectionery/FormPastry.cs b/Confectionery/FormPastry.cs index e3e7bfd..7caf7e6 100644 --- a/Confectionery/FormPastry.cs +++ b/Confectionery/FormPastry.cs @@ -82,7 +82,7 @@ namespace ConfectioneryView { return; } - _logger.LogInformation("Добавление нового компонента: { ComponentName}- { Count}", + _logger.LogInformation("Добавление нового компонента: { PastryName}- { Count}", form.ComponentModel.ComponentName, form.Count); if (_pastryComponents.ContainsKey(form.Id)) { @@ -114,7 +114,7 @@ namespace ConfectioneryView { return; } - _logger.LogInformation("Изменение компонента: { ComponentName} - { Count} ", + _logger.LogInformation("Изменение компонента: { PastryName} - { Count} ", form.ComponentModel.ComponentName, form.Count); _pastryComponents[id] = (form.ComponentModel, form.Count); LoadData(); @@ -131,7 +131,7 @@ namespace ConfectioneryView { try { - _logger.LogInformation("Удаление компонента: { ComponentName}- { Count}", + _logger.LogInformation("Удаление компонента: { PastryName}- { Count}", dataGridView.SelectedRows[0].Cells[1].Value); _pastryComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); } diff --git a/Confectionery/FormPastryComponent.cs b/Confectionery/FormPastryComponent.cs index 11933f1..c7dffc4 100644 --- a/Confectionery/FormPastryComponent.cs +++ b/Confectionery/FormPastryComponent.cs @@ -47,7 +47,7 @@ namespace ConfectioneryView _list = logic.ReadList(null); if (_list != null) { - comboBoxComponent.DisplayMember = "ComponentName"; + comboBoxComponent.DisplayMember = "PastryName"; comboBoxComponent.ValueMember = "Id"; comboBoxComponent.DataSource = _list; comboBoxComponent.SelectedItem = null; diff --git a/Confectionery/FormReportPastryComponents.Designer.cs b/Confectionery/FormReportPastryComponents.Designer.cs index 79d208f..c03df90 100644 --- a/Confectionery/FormReportPastryComponents.Designer.cs +++ b/Confectionery/FormReportPastryComponents.Designer.cs @@ -28,87 +28,86 @@ /// private void InitializeComponent() { - this.dataGridView = new System.Windows.Forms.DataGridView(); - this.buttonSaveToExcel = new System.Windows.Forms.Button(); - this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColumnPastry = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); - this.SuspendLayout(); + dataGridView = new DataGridView(); + buttonSaveToExcel = new Button(); + ColumnPastry = new DataGridViewTextBoxColumn(); + ColumnComponent = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); // // dataGridView // - this.dataGridView.AllowUserToAddRows = false; - this.dataGridView.AllowUserToDeleteRows = false; - this.dataGridView.AllowUserToOrderColumns = true; - this.dataGridView.AllowUserToResizeColumns = false; - this.dataGridView.AllowUserToResizeRows = false; - this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.ColumnComponent, - this.ColumnPastry, - this.ColumnCount}); - this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom; - this.dataGridView.Location = new System.Drawing.Point(0, 41); - this.dataGridView.MultiSelect = false; - this.dataGridView.Name = "dataGridView"; - this.dataGridView.ReadOnly = true; - this.dataGridView.RowHeadersVisible = false; - this.dataGridView.Size = new System.Drawing.Size(528, 442); - this.dataGridView.TabIndex = 0; + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToOrderColumns = true; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.BackgroundColor = SystemColors.ControlLightLight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnPastry, ColumnComponent, ColumnCount }); + dataGridView.Dock = DockStyle.Bottom; + dataGridView.Location = new Point(0, 47); + dataGridView.Margin = new Padding(4, 3, 4, 3); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.Size = new Size(616, 510); + dataGridView.TabIndex = 0; // // buttonSaveToExcel // - this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 12); - this.buttonSaveToExcel.Name = "buttonSaveToExcel"; - this.buttonSaveToExcel.Size = new System.Drawing.Size(159, 23); - this.buttonSaveToExcel.TabIndex = 1; - this.buttonSaveToExcel.Text = "Сохранить в Excel"; - this.buttonSaveToExcel.UseVisualStyleBackColor = true; - this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click); - // - // ColumnComponent - // - this.ColumnComponent.HeaderText = "Компонент"; - this.ColumnComponent.Name = "ColumnComponent"; - this.ColumnComponent.ReadOnly = true; - this.ColumnComponent.Width = 200; + buttonSaveToExcel.Location = new Point(14, 14); + buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3); + buttonSaveToExcel.Name = "buttonSaveToExcel"; + buttonSaveToExcel.Size = new Size(186, 27); + buttonSaveToExcel.TabIndex = 1; + buttonSaveToExcel.Text = "Сохранить в Excel"; + buttonSaveToExcel.UseVisualStyleBackColor = true; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; // // ColumnPastry // - this.ColumnPastry.HeaderText = "Изделие"; - this.ColumnPastry.Name = "ColumnPastry"; - this.ColumnPastry.ReadOnly = true; - this.ColumnPastry.Width = 200; + ColumnPastry.HeaderText = "Изделие"; + ColumnPastry.Name = "ColumnPastry"; + ColumnPastry.ReadOnly = true; + ColumnPastry.Width = 200; + // + // ColumnComponent + // + ColumnComponent.HeaderText = "Компонент"; + ColumnComponent.Name = "ColumnComponent"; + ColumnComponent.ReadOnly = true; + ColumnComponent.Width = 200; // // ColumnCount // - this.ColumnCount.HeaderText = "Количество"; - this.ColumnCount.Name = "ColumnCount"; - this.ColumnCount.ReadOnly = true; + ColumnCount.HeaderText = "Количество"; + ColumnCount.Name = "ColumnCount"; + ColumnCount.ReadOnly = true; // // FormReportPastryComponents // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(528, 483); - this.Controls.Add(this.buttonSaveToExcel); - this.Controls.Add(this.dataGridView); - this.Name = "FormReportPastryComponents"; - this.Text = "Компоненты по изделиям"; - this.Load += new System.EventHandler(this.FormReportPastryComponents_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(616, 557); + Controls.Add(buttonSaveToExcel); + Controls.Add(dataGridView); + Margin = new Padding(4, 3, 4, 3); + Name = "FormReportPastryComponents"; + Text = "Изделия с компонентами"; + Load += FormReportPastryComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); } #endregion private System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.Button buttonSaveToExcel; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnComponent; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnPastry; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnCount; + private DataGridViewTextBoxColumn ColumnPastry; + private DataGridViewTextBoxColumn ColumnComponent; + private DataGridViewTextBoxColumn ColumnCount; } } \ No newline at end of file diff --git a/Confectionery/FormReportPastryComponents.cs b/Confectionery/FormReportPastryComponents.cs index 2d366fa..16d7a9a 100644 --- a/Confectionery/FormReportPastryComponents.cs +++ b/Confectionery/FormReportPastryComponents.cs @@ -36,8 +36,8 @@ namespace ConfectioneryView dataGridView.Rows.Clear(); foreach (var elem in dict) { - dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); - foreach (var listElem in elem.Pastries) + dataGridView.Rows.Add(new object[] { elem.PastryName, "", "" }); + foreach (var listElem in elem.Components) { dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); } diff --git a/Confectionery/FormReportPastryComponents.resx b/Confectionery/FormReportPastryComponents.resx index 1af7de1..f298a7b 100644 --- a/Confectionery/FormReportPastryComponents.resx +++ b/Confectionery/FormReportPastryComponents.resx @@ -1,64 +1,4 @@ - - - + diff --git a/ConfectioneryContracts/ViewModels/ReportPastryComponentViewModel.cs b/ConfectioneryContracts/ViewModels/ReportPastryComponentViewModel.cs index 8cef604..f1df7d2 100644 --- a/ConfectioneryContracts/ViewModels/ReportPastryComponentViewModel.cs +++ b/ConfectioneryContracts/ViewModels/ReportPastryComponentViewModel.cs @@ -8,8 +8,8 @@ namespace ConfectioneryContracts.ViewModels { public class ReportPastryComponentViewModel { - public string ComponentName { get; set; } = string.Empty; + public string PastryName { get; set; } = string.Empty; public int TotalCount { get; set; } - public List> Pastries { get; set; } = new(); + public List> Components { get; set; } = new(); } } diff --git a/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.Designer.cs b/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.Designer.cs index 4922144..2b69cfd 100644 --- a/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.Designer.cs +++ b/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.Designer.cs @@ -25,7 +25,7 @@ namespace ConfectioneryDatabaseImplement.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => + modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -33,7 +33,7 @@ namespace ConfectioneryDatabaseImplement.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("ComponentName") + b.Property("PastryName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -95,7 +95,7 @@ namespace ConfectioneryDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("Pastries"); + b.ToTable("Components"); }); modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => @@ -137,7 +137,7 @@ namespace ConfectioneryDatabaseImplement.Migrations modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => { - b.HasOne("ConfectioneryDatabaseImplement.Models.Component", "Component") + b.HasOne("ConfectioneryDatabaseImplement.Models.Components", "Components") .WithMany("PastryComponents") .HasForeignKey("ComponentId") .OnDelete(DeleteBehavior.Cascade) @@ -149,12 +149,12 @@ namespace ConfectioneryDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Component"); + b.Navigation("Components"); b.Navigation("Pastry"); }); - modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => + modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b => { b.Navigation("PastryComponents"); }); diff --git a/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.cs b/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.cs index d633f68..d99ff99 100644 --- a/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.cs +++ b/ConfectioneryDatabaseImplement/Migrations/20230219142123_InitialCreate.cs @@ -26,7 +26,7 @@ namespace ConfectioneryDatabaseImplement.Migrations }); migrationBuilder.CreateTable( - name: "Pastries", + name: "Components", columns: table => new { Id = table.Column(type: "int", nullable: false) @@ -58,7 +58,7 @@ namespace ConfectioneryDatabaseImplement.Migrations table.ForeignKey( name: "FK_Orders_Pastries_PastryId", column: x => x.PastryId, - principalTable: "Pastries", + principalTable: "Components", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -85,7 +85,7 @@ namespace ConfectioneryDatabaseImplement.Migrations table.ForeignKey( name: "FK_PastryComponents_Pastries_PastryId", column: x => x.PastryId, - principalTable: "Pastries", + principalTable: "Components", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -119,7 +119,7 @@ namespace ConfectioneryDatabaseImplement.Migrations name: "Components"); migrationBuilder.DropTable( - name: "Pastries"); + name: "Components"); } } } diff --git a/ConfectioneryDatabaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs b/ConfectioneryDatabaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs index a67eb4a..8bcb3ae 100644 --- a/ConfectioneryDatabaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs +++ b/ConfectioneryDatabaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs @@ -22,7 +22,7 @@ namespace ConfectioneryDatabaseImplement.Migrations SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => + modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -30,7 +30,7 @@ namespace ConfectioneryDatabaseImplement.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("ComponentName") + b.Property("PastryName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -92,7 +92,7 @@ namespace ConfectioneryDatabaseImplement.Migrations b.HasKey("Id"); - b.ToTable("Pastries"); + b.ToTable("Components"); }); modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => @@ -134,7 +134,7 @@ namespace ConfectioneryDatabaseImplement.Migrations modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b => { - b.HasOne("ConfectioneryDatabaseImplement.Models.Component", "Component") + b.HasOne("ConfectioneryDatabaseImplement.Models.Components", "Components") .WithMany("PastryComponents") .HasForeignKey("ComponentId") .OnDelete(DeleteBehavior.Cascade) @@ -146,12 +146,12 @@ namespace ConfectioneryDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Component"); + b.Navigation("Components"); b.Navigation("Pastry"); }); - modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b => + modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Components", b => { b.Navigation("PastryComponents"); });