diff --git a/VolkovLabs/InternetShopDataModels/IId.cs b/VolkovLabs/InternetShopDataModels/IId.cs
new file mode 100644
index 0000000..0290158
--- /dev/null
+++ b/VolkovLabs/InternetShopDataModels/IId.cs
@@ -0,0 +1,7 @@
+namespace InternetShopOrdersDataModels
+{
+ public interface IId
+ {
+ int Id { get; }
+ }
+}
diff --git a/VolkovLabs/InternetShopDataModels/InternetShopDataModels.csproj b/VolkovLabs/InternetShopDataModels/InternetShopDataModels.csproj
new file mode 100644
index 0000000..fa71b7a
--- /dev/null
+++ b/VolkovLabs/InternetShopDataModels/InternetShopDataModels.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/VolkovLabs/InternetShopDataModels/Models/IOrderModel.cs b/VolkovLabs/InternetShopDataModels/Models/IOrderModel.cs
new file mode 100644
index 0000000..7e32244
--- /dev/null
+++ b/VolkovLabs/InternetShopDataModels/Models/IOrderModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersDataModels.Models
+{
+ public interface IOrderModel : IId
+ {
+ string Fullname { get; }
+ public string OrderImage { get; }
+ public int SelectedItemId { get; }
+ string Email { get; }
+ }
+}
diff --git a/VolkovLabs/InternetShopDataModels/Models/ISelectedItemModel.cs b/VolkovLabs/InternetShopDataModels/Models/ISelectedItemModel.cs
new file mode 100644
index 0000000..61bb65e
--- /dev/null
+++ b/VolkovLabs/InternetShopDataModels/Models/ISelectedItemModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersDataModels.Models
+{
+ public interface ISelectedItemModel : IId
+ {
+ string Name { get; }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersApp/FormMain.Designer.cs b/VolkovLabs/InternetShopOrdersApp/FormMain.Designer.cs
new file mode 100644
index 0000000..feb3228
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormMain.Designer.cs
@@ -0,0 +1,39 @@
+namespace InternetShopOrdersApp
+{
+ partial class FormMain
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "FormMain";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersApp/FormMain.cs b/VolkovLabs/InternetShopOrdersApp/FormMain.cs
new file mode 100644
index 0000000..bbd8688
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormMain.cs
@@ -0,0 +1,42 @@
+using InternetShopOrdersBusinessLogic.BusinessLogics;
+using InternetShopOrdersContracts.BusinessLogicContracts;
+using InternetShopOrdersContracts.ViewModels;
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace InternetShopOrdersApp
+{
+ public partial class FormMain : Form
+ {
+ private int? _id;
+ private readonly IOrderLogic _logic;
+ private readonly ISelectedItemLogic _selectedItemLogic;
+ private List _selectedItems;
+ private string? orderImage = null;
+
+ public int Id { set { Id = value; } }
+
+ public FormMain(IOrderLogic logic, ISelectedItemLogic selectedItemLogic)
+ {
+ InitializeComponent();
+ _logic = logic;
+ _selectedItemLogic = selectedItemLogic;
+ _selectedItems = new List();
+ }
+
+ private void FormOrder_Load(object sender, EventArgs e)
+ {
+ _selectedItems = _selectedItemLogic.ReadList(null);
+
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersApp/FormMain.resx b/VolkovLabs/InternetShopOrdersApp/FormMain.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormMain.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersApp/FormOrder.Designer.cs b/VolkovLabs/InternetShopOrdersApp/FormOrder.Designer.cs
new file mode 100644
index 0000000..aa2c7a1
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormOrder.Designer.cs
@@ -0,0 +1,39 @@
+namespace InternetShopOrdersApp
+{
+ partial class FormOrder
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "FormOrder";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersApp/FormOrder.cs b/VolkovLabs/InternetShopOrdersApp/FormOrder.cs
new file mode 100644
index 0000000..7e1816a
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormOrder.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace InternetShopOrdersApp
+{
+ public partial class FormOrder : Form
+ {
+ public FormOrder()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersApp/FormOrder.resx b/VolkovLabs/InternetShopOrdersApp/FormOrder.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormOrder.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.Designer.cs b/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.Designer.cs
new file mode 100644
index 0000000..ca1d57c
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.Designer.cs
@@ -0,0 +1,39 @@
+namespace InternetShopOrdersApp
+{
+ partial class FormSelectedItems
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "FormSelectedItems";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.cs b/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.cs
new file mode 100644
index 0000000..4b291df
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace InternetShopOrdersApp
+{
+ public partial class FormSelectedItems : Form
+ {
+ public FormSelectedItems()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.resx b/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/FormSelectedItems.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersApp/InternetShopOrdersApp.csproj b/VolkovLabs/InternetShopOrdersApp/InternetShopOrdersApp.csproj
new file mode 100644
index 0000000..dc97df1
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/InternetShopOrdersApp.csproj
@@ -0,0 +1,25 @@
+
+
+
+ net8.0-windows
+ enable
+ true
+ enable
+ WinExe
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VolkovLabs/InternetShopOrdersApp/Program.cs b/VolkovLabs/InternetShopOrdersApp/Program.cs
new file mode 100644
index 0000000..5cda5e8
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersApp/Program.cs
@@ -0,0 +1,41 @@
+using InternetShopOrdersBusinessLogic.BusinessLogics;
+using InternetShopOrdersContracts.BusinessLogicContracts;
+using InternetShopOrdersContracts.StorageContracts;
+using InternetShopOrdersDatabaseImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+
+namespace InternetShopOrdersApp
+{
+ internal static class Program
+ {
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
+
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ }
+ }
+}
\ No newline at end of file
diff --git a/VolkovLabs/InternetShopOrdersBusinessLogic/BusinessLogics/OrderLogic.cs b/VolkovLabs/InternetShopOrdersBusinessLogic/BusinessLogics/OrderLogic.cs
new file mode 100644
index 0000000..742707d
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -0,0 +1,92 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.BusinessLogicContracts;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.StorageContracts;
+using InternetShopOrdersContracts.ViewModels;
+
+namespace InternetShopOrdersBusinessLogic.BusinessLogics
+{
+ public class OrderLogic : IOrderLogic
+ {
+ private readonly IOrderStorage _orderStorage;
+
+ public OrderLogic(IOrderStorage orderStorage)
+ {
+ _orderStorage = orderStorage;
+ }
+
+ public List? ReadList(OrderSearchModel? model)
+ {
+ var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ return null;
+ }
+ return list;
+ }
+
+ public OrderViewModel? ReadElement(OrderSearchModel? model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _orderStorage.GetElement(model);
+ if (element == null)
+ {
+ return null;
+ }
+ return element;
+ }
+
+ public bool Create(OrderBindingModel model)
+ {
+ CheckModel(model);
+ if (_orderStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public bool Update(OrderBindingModel model)
+ {
+ CheckModel(model);
+ if (_orderStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(OrderBindingModel model)
+ {
+ CheckModel(model, false);
+ if (_orderStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(OrderBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.Fullname))
+ {
+ throw new ArgumentNullException("Нет ФИО заказчика", nameof(model.Fullname));
+ }
+ if (string.IsNullOrEmpty(model.Email))
+ {
+ throw new ArgumentNullException("Нет электронной почты заказчика", nameof(model.Email));
+ }
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersBusinessLogic/BusinessLogics/SelectedItemLogic.cs b/VolkovLabs/InternetShopOrdersBusinessLogic/BusinessLogics/SelectedItemLogic.cs
new file mode 100644
index 0000000..19321db
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersBusinessLogic/BusinessLogics/SelectedItemLogic.cs
@@ -0,0 +1,87 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.BusinessLogicContracts;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.StorageContracts;
+using InternetShopOrdersContracts.ViewModels;
+
+namespace InternetShopOrdersBusinessLogic.BusinessLogics
+{
+ public class SelectedItemLogic : ISelectedItemLogic
+ {
+ private readonly ISelectedItemStorage _selectedItemStorage;
+
+ public SelectedItemLogic(ISelectedItemStorage selectedItemStorage)
+ {
+ _selectedItemStorage = selectedItemStorage;
+ }
+
+ public List? ReadList(SelectedItemSearchModel? model)
+ {
+ var list = model == null ? _selectedItemStorage.GetFullList() : _selectedItemStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ return null;
+ }
+ return list;
+ }
+
+ public SelectedItemViewModel? ReadElement(SelectedItemSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _selectedItemStorage.GetElement(model);
+ if (element == null)
+ {
+ return null;
+ }
+ return element;
+ }
+
+ public bool Create(SelectedItemBindingModel model)
+ {
+ CheckModel(model);
+ if (_selectedItemStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public bool Update(SelectedItemBindingModel model)
+ {
+ CheckModel(model);
+ if (_selectedItemStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(SelectedItemBindingModel model)
+ {
+ CheckModel(model, false);
+ if (_selectedItemStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(SelectedItemBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.Name))
+ {
+ throw new ArgumentNullException("Нет названия выбранного товара", nameof(model.Name));
+ }
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersBusinessLogic/InternetShopOrdersBusinessLogic.csproj b/VolkovLabs/InternetShopOrdersBusinessLogic/InternetShopOrdersBusinessLogic.csproj
new file mode 100644
index 0000000..febe937
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersBusinessLogic/InternetShopOrdersBusinessLogic.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/VolkovLabs/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs b/VolkovLabs/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs
new file mode 100644
index 0000000..b9107e0
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/BindingModels/OrderBindingModel.cs
@@ -0,0 +1,13 @@
+using InternetShopOrdersDataModels.Models;
+
+namespace InternetShopOrdersContracts.BindingModels
+{
+ public class OrderBindingModel : IOrderModel
+ {
+ public int Id { get; set; }
+ public string Fullname { get; set; } = string.Empty;
+ public string OrderImage { get; set; }
+ public int SelectedItemId { get; set; }
+ public string Email { get; set; } = string.Empty;
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/BindingModels/SelectedItemBindingModel.cs b/VolkovLabs/InternetShopOrdersContracts/BindingModels/SelectedItemBindingModel.cs
new file mode 100644
index 0000000..73ed4eb
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/BindingModels/SelectedItemBindingModel.cs
@@ -0,0 +1,15 @@
+using InternetShopOrdersDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.BindingModels
+{
+ public class SelectedItemBindingModel : ISelectedItemModel
+ {
+ public int Id { get; set; }
+ public string Name { get; set; } = String.Empty;
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/BusinessLogicContracts/IOrderLogic.cs b/VolkovLabs/InternetShopOrdersContracts/BusinessLogicContracts/IOrderLogic.cs
new file mode 100644
index 0000000..b7ff318
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/BusinessLogicContracts/IOrderLogic.cs
@@ -0,0 +1,20 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.BusinessLogicContracts
+{
+ public interface IOrderLogic
+ {
+ List? ReadList(OrderSearchModel? model);
+ OrderViewModel? ReadElement(OrderSearchModel model);
+ bool Create(OrderBindingModel model);
+ bool Update(OrderBindingModel model);
+ bool Delete(OrderBindingModel model);
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/BusinessLogicContracts/ISelectedItemLogic.cs b/VolkovLabs/InternetShopOrdersContracts/BusinessLogicContracts/ISelectedItemLogic.cs
new file mode 100644
index 0000000..fb5d242
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/BusinessLogicContracts/ISelectedItemLogic.cs
@@ -0,0 +1,20 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.BusinessLogicContracts
+{
+ public interface ISelectedItemLogic
+ {
+ List? ReadList(SelectedItemSearchModel? model);
+ SelectedItemViewModel? ReadElement(SelectedItemSearchModel model);
+ bool Create(SelectedItemBindingModel model);
+ bool Update(SelectedItemBindingModel model);
+ bool Delete(SelectedItemBindingModel model);
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/InternetShopOrdersContracts.csproj b/VolkovLabs/InternetShopOrdersContracts/InternetShopOrdersContracts.csproj
new file mode 100644
index 0000000..94ceabc
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/InternetShopOrdersContracts.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/VolkovLabs/InternetShopOrdersContracts/SearchModels/OrderSearchModel.cs b/VolkovLabs/InternetShopOrdersContracts/SearchModels/OrderSearchModel.cs
new file mode 100644
index 0000000..7cbdd5b
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/SearchModels/OrderSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.SearchModels
+{
+ public class OrderSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/SearchModels/SelectedItemSearchModel.cs b/VolkovLabs/InternetShopOrdersContracts/SearchModels/SelectedItemSearchModel.cs
new file mode 100644
index 0000000..e3ba3f8
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/SearchModels/SelectedItemSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.SearchModels
+{
+ public class SelectedItemSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/StorageContracts/IOrderStorage.cs b/VolkovLabs/InternetShopOrdersContracts/StorageContracts/IOrderStorage.cs
new file mode 100644
index 0000000..c7dae00
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/StorageContracts/IOrderStorage.cs
@@ -0,0 +1,21 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.StorageContracts
+{
+ public interface IOrderStorage
+ {
+ List GetFullList();
+ List GetFilteredList(OrderSearchModel model);
+ OrderViewModel? GetElement(OrderSearchModel model);
+ OrderViewModel? Insert(OrderBindingModel model);
+ OrderViewModel? Update(OrderBindingModel model);
+ OrderViewModel? Delete(OrderBindingModel model);
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/StorageContracts/ISelectedItemStorage.cs b/VolkovLabs/InternetShopOrdersContracts/StorageContracts/ISelectedItemStorage.cs
new file mode 100644
index 0000000..fecdadd
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/StorageContracts/ISelectedItemStorage.cs
@@ -0,0 +1,21 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.StorageContracts
+{
+ public interface ISelectedItemStorage
+ {
+ List GetFullList();
+ List GetFilteredList(SelectedItemSearchModel model);
+ SelectedItemViewModel? GetElement(SelectedItemSearchModel model);
+ SelectedItemViewModel? Insert(SelectedItemBindingModel model);
+ SelectedItemViewModel? Update(SelectedItemBindingModel model);
+ SelectedItemViewModel? Delete(SelectedItemBindingModel model);
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/ViewModels/OrderViewModel.cs b/VolkovLabs/InternetShopOrdersContracts/ViewModels/OrderViewModel.cs
new file mode 100644
index 0000000..abf830d
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/ViewModels/OrderViewModel.cs
@@ -0,0 +1,26 @@
+using InternetShopOrdersDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.ViewModels
+{
+ public class OrderViewModel : IOrderModel
+ {
+ public int Id { get; set; }
+
+ [DisplayName("ФИО заказчика")]
+ public string Fullname { get; set; } = string.Empty;
+
+ public string OrderImage { get; set; } = string.Empty;
+
+ public int SelectedItemId { get; set; }
+ public string SelectedItemName { get; set; } = string.Empty;
+
+ [DisplayName("Электронная почта")]
+ public string Email { get; set; } = string.Empty;
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersContracts/ViewModels/SelectedItemViewModel.cs b/VolkovLabs/InternetShopOrdersContracts/ViewModels/SelectedItemViewModel.cs
new file mode 100644
index 0000000..21b1121
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersContracts/ViewModels/SelectedItemViewModel.cs
@@ -0,0 +1,17 @@
+using InternetShopOrdersDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersContracts.ViewModels
+{
+ public class SelectedItemViewModel : ISelectedItemModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название")]
+ public string Name { get; set; } = string.Empty;
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Implements/OrderStorage.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Implements/OrderStorage.cs
new file mode 100644
index 0000000..3ba962c
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Implements/OrderStorage.cs
@@ -0,0 +1,87 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.StorageContracts;
+using InternetShopOrdersContracts.ViewModels;
+using InternetShopOrdersDatabaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+using System.Security.Principal;
+
+namespace InternetShopOrdersDatabaseImplement.Implements
+{
+ public class OrderStorage : IOrderStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new OrdersDatabase();
+ return context.Orders
+ .Include(x => x.SelectedItem)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public List GetFilteredList(OrderSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return new();
+ }
+
+ using var context = new OrdersDatabase();
+ return context.Orders
+ .Include(x => x.SelectedItem)
+ .Where(x => x.Id == model.Id)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public OrderViewModel? GetElement(OrderSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return null;
+ }
+
+ using var context = new OrdersDatabase();
+ return context.Orders
+ .Include(x => x.SelectedItem)
+ .FirstOrDefault(x => x.Id == model.Id)
+ ?.GetViewModel;
+ }
+ public OrderViewModel? Insert(OrderBindingModel model)
+ {
+ using var context = new OrdersDatabase();
+ var newOrder = Orders.Create(context, model);
+ if (newOrder == null)
+ {
+ return null;
+ }
+ context.Orders.Add(newOrder);
+ context.SaveChanges();
+ return newOrder.GetViewModel;
+ }
+ public OrderViewModel? Update(OrderBindingModel model)
+ {
+ using var context = new OrdersDatabase();
+ var Order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
+ if (Order == null)
+ {
+ return null;
+ }
+ Order.Update(model, context);
+ context.SaveChanges();
+ return Order.GetViewModel;
+ }
+ public OrderViewModel? Delete(OrderBindingModel model)
+ {
+ using var context = new OrdersDatabase();
+ var element = context.Orders
+ .Include(x => x.SelectedItem)
+ .FirstOrDefault(rec => rec.Id == model.Id);
+ if (element != null)
+ {
+ context.Orders.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ return null;
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Implements/SelectedItemStorage.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Implements/SelectedItemStorage.cs
new file mode 100644
index 0000000..767516b
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Implements/SelectedItemStorage.cs
@@ -0,0 +1,79 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.SearchModels;
+using InternetShopOrdersContracts.StorageContracts;
+using InternetShopOrdersContracts.ViewModels;
+using InternetShopOrdersDatabaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+
+namespace InternetShopOrdersDatabaseImplement.Implements
+{
+ public class SelectedItemStorage : ISelectedItemStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new OrdersDatabase();
+ return context.SelectedItems
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public List GetFilteredList(SelectedItemSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return new();
+ }
+ using var context = new OrdersDatabase();
+ return context.SelectedItems
+ .Where(x => x.Id == model.Id)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public SelectedItemViewModel? GetElement(SelectedItemSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return null;
+ }
+ using var context = new OrdersDatabase();
+ return context.SelectedItems
+ .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
+ ?.GetViewModel;
+ }
+ public SelectedItemViewModel? Insert(SelectedItemBindingModel model)
+ {
+ var newSelectedItem = SelectedItem.Create(model);
+ if (newSelectedItem == null)
+ {
+ return null;
+ }
+ using var context = new OrdersDatabase();
+ context.SelectedItems.Add(newSelectedItem);
+ context.SaveChanges();
+ return newSelectedItem.GetViewModel;
+ }
+ public SelectedItemViewModel? Update(SelectedItemBindingModel model)
+ {
+ using var context = new OrdersDatabase();
+ var component = context.SelectedItems.FirstOrDefault(x => x.Id == model.Id);
+ if (component == null)
+ {
+ return null;
+ }
+ component.Update(model);
+ context.SaveChanges();
+ return component.GetViewModel;
+ }
+ public SelectedItemViewModel? Delete(SelectedItemBindingModel model)
+ {
+ using var context = new OrdersDatabase();
+ var element = context.SelectedItems.FirstOrDefault(rec => rec.Id == model.Id);
+ if (element != null)
+ {
+ context.SelectedItems.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ return null;
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/InternetShopOrdersDatabaseImplement.csproj b/VolkovLabs/InternetShopOrdersDatabaseImplement/InternetShopOrdersDatabaseImplement.csproj
new file mode 100644
index 0000000..5fcaae6
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/InternetShopOrdersDatabaseImplement.csproj
@@ -0,0 +1,22 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/20241016152345_InitialMig.Designer.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/20241016152345_InitialMig.Designer.cs
new file mode 100644
index 0000000..dfa1429
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/20241016152345_InitialMig.Designer.cs
@@ -0,0 +1,87 @@
+//
+using InternetShopOrdersDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace InternetShopOrdersDatabaseImplement.Migrations
+{
+ [DbContext(typeof(OrdersDatabase))]
+ [Migration("20241016152345_InitialMig")]
+ partial class InitialMig
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Fullname")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("OrderImage")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SelectedItemId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SelectedItemId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.SelectedItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("SelectedItems");
+ });
+
+ modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
+ {
+ b.HasOne("InternetShopOrdersDatabaseImplement.Models.SelectedItem", "SelectedItem")
+ .WithMany()
+ .HasForeignKey("SelectedItemId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("SelectedItem");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/20241016152345_InitialMig.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/20241016152345_InitialMig.cs
new file mode 100644
index 0000000..35d126a
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/20241016152345_InitialMig.cs
@@ -0,0 +1,65 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace InternetShopOrdersDatabaseImplement.Migrations
+{
+ ///
+ public partial class InitialMig : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "SelectedItems",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_SelectedItems", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Orders",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Fullname = table.Column(type: "text", nullable: false),
+ Email = table.Column(type: "text", nullable: false),
+ SelectedItemId = table.Column(type: "integer", nullable: false),
+ OrderImage = table.Column(type: "text", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Orders", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Orders_SelectedItems_SelectedItemId",
+ column: x => x.SelectedItemId,
+ principalTable: "SelectedItems",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Orders_SelectedItemId",
+ table: "Orders",
+ column: "SelectedItemId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "SelectedItems");
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/OrdersDatabaseModelSnapshot.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/OrdersDatabaseModelSnapshot.cs
new file mode 100644
index 0000000..6dd5155
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Migrations/OrdersDatabaseModelSnapshot.cs
@@ -0,0 +1,84 @@
+//
+using InternetShopOrdersDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace InternetShopOrdersDatabaseImplement.Migrations
+{
+ [DbContext(typeof(OrdersDatabase))]
+ partial class OrdersDatabaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Fullname")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("OrderImage")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SelectedItemId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SelectedItemId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.SelectedItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("SelectedItems");
+ });
+
+ modelBuilder.Entity("InternetShopOrdersDatabaseImplement.Models.Orders", b =>
+ {
+ b.HasOne("InternetShopOrdersDatabaseImplement.Models.SelectedItem", "SelectedItem")
+ .WithMany()
+ .HasForeignKey("SelectedItemId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("SelectedItem");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Models/Orders.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Models/Orders.cs
new file mode 100644
index 0000000..4541011
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Models/Orders.cs
@@ -0,0 +1,69 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.ViewModels;
+using InternetShopOrdersDataModels.Models;
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersDatabaseImplement.Models
+{
+ public class Orders : IOrderModel
+ {
+ [Required]
+ public string Fullname { get; set; } = string.Empty;
+ [Required]
+ public string Email { get; set; } = string.Empty;
+
+ public int Id { get; private set; }
+
+ public int SelectedItemId { get; set; }
+
+ public virtual SelectedItem SelectedItem { get; set; } = new();
+
+ [Required]
+ public string OrderImage { get; set; } = string.Empty;
+
+ public static Orders? Create(OrdersDatabase context, OrderBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Orders()
+ {
+ Id = model.Id,
+ Fullname = model.Fullname,
+ Email = model.Email,
+ SelectedItemId = model.SelectedItemId,
+ SelectedItem = context.SelectedItems.First(x => x.Id == model.SelectedItemId),
+ OrderImage = model.OrderImage,
+ };
+ }
+
+ public void Update(OrderBindingModel? model, OrdersDatabase context)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Fullname = model.Fullname;
+ SelectedItemId = model.SelectedItemId;
+ SelectedItem = context.SelectedItems.First(x => x.Id == model.SelectedItemId);
+ OrderImage = model.OrderImage;
+ }
+
+ public OrderViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Fullname = Fullname,
+ Email = Email,
+ SelectedItemId = SelectedItemId,
+ SelectedItemName = SelectedItem.Name,
+ OrderImage = OrderImage,
+ };
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/Models/SelectedItem.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/Models/SelectedItem.cs
new file mode 100644
index 0000000..9486a94
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/Models/SelectedItem.cs
@@ -0,0 +1,54 @@
+using InternetShopOrdersContracts.BindingModels;
+using InternetShopOrdersContracts.ViewModels;
+using InternetShopOrdersDataModels.Models;
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersDatabaseImplement.Models
+{
+ public class SelectedItem : ISelectedItemModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public string Name { get; private set; } = string.Empty;
+
+ public static SelectedItem? Create(SelectedItemBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new SelectedItem()
+ {
+ Id = model.Id,
+ Name = model.Name,
+ };
+ }
+ public static SelectedItem? Create(SelectedItemViewModel? model)
+ {
+ return new SelectedItem()
+ {
+ Id = model.Id,
+ Name = model.Name,
+ };
+ }
+ public void Update(SelectedItemBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Name = model.Name;
+ }
+ public SelectedItemViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Name = Name,
+ };
+ }
+}
diff --git a/VolkovLabs/InternetShopOrdersDatabaseImplement/OrdersDatabase.cs b/VolkovLabs/InternetShopOrdersDatabaseImplement/OrdersDatabase.cs
new file mode 100644
index 0000000..324f8a5
--- /dev/null
+++ b/VolkovLabs/InternetShopOrdersDatabaseImplement/OrdersDatabase.cs
@@ -0,0 +1,20 @@
+using InternetShopOrdersDatabaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Principal;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InternetShopOrdersDatabaseImplement
+{
+ public class OrdersDatabase : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ => optionsBuilder.UseNpgsql("Host=localhost;Database=InternetShopOrdersDB;Username=postgres;Password=postgres");
+
+ public virtual DbSet Orders { set; get; }
+ public virtual DbSet SelectedItems { set; get; }
+ }
+}
diff --git a/VolkovLabs/VolkovLabs.sln b/VolkovLabs/VolkovLabs.sln
index 865e17e..c6e6d49 100644
--- a/VolkovLabs/VolkovLabs.sln
+++ b/VolkovLabs/VolkovLabs.sln
@@ -5,7 +5,17 @@ VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsLibraryVolkov", "WinFormsLibraryVolkov\WinFormsLibraryVolkov.csproj", "{80044A4D-FF3B-4CA9-AA16-4E4E2520B60C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsTestApp", "WinFormsTestApp\WinFormsTestApp.csproj", "{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsTestApp", "WinFormsTestApp\WinFormsTestApp.csproj", "{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersBusinessLogic", "InternetShopOrdersBusinessLogic\InternetShopOrdersBusinessLogic.csproj", "{30B57BEC-D1B0-411A-87B2-3E138A20DC8E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersContracts", "InternetShopOrdersContracts\InternetShopOrdersContracts.csproj", "{8883886C-DDAC-43DC-885F-4A9B2FBE007E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersDatabaseImplement", "InternetShopOrdersDatabaseImplement\InternetShopOrdersDatabaseImplement.csproj", "{3F616681-9757-4B12-9931-CC7B6872FD5F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopDataModels", "InternetShopDataModels\InternetShopDataModels.csproj", "{1CEB87FB-BA72-491C-9125-0B3527EF612E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetShopOrdersApp", "InternetShopOrdersApp\InternetShopOrdersApp.csproj", "{13A6EC26-C739-4891-964C-4A0E5E8D43C3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +31,26 @@ Global
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Release|Any CPU.Build.0 = Release|Any CPU
+ {30B57BEC-D1B0-411A-87B2-3E138A20DC8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {30B57BEC-D1B0-411A-87B2-3E138A20DC8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {30B57BEC-D1B0-411A-87B2-3E138A20DC8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30B57BEC-D1B0-411A-87B2-3E138A20DC8E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8883886C-DDAC-43DC-885F-4A9B2FBE007E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8883886C-DDAC-43DC-885F-4A9B2FBE007E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8883886C-DDAC-43DC-885F-4A9B2FBE007E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8883886C-DDAC-43DC-885F-4A9B2FBE007E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3F616681-9757-4B12-9931-CC7B6872FD5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3F616681-9757-4B12-9931-CC7B6872FD5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3F616681-9757-4B12-9931-CC7B6872FD5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3F616681-9757-4B12-9931-CC7B6872FD5F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1CEB87FB-BA72-491C-9125-0B3527EF612E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1CEB87FB-BA72-491C-9125-0B3527EF612E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1CEB87FB-BA72-491C-9125-0B3527EF612E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1CEB87FB-BA72-491C-9125-0B3527EF612E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {13A6EC26-C739-4891-964C-4A0E5E8D43C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {13A6EC26-C739-4891-964C-4A0E5E8D43C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {13A6EC26-C739-4891-964C-4A0E5E8D43C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {13A6EC26-C739-4891-964C-4A0E5E8D43C3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE