diff --git a/UserComponentsOption19/AppShopInternetOption19/AppShopInternetOption19.csproj b/UserComponentsOption19/AppShopInternetOption19/AppShopInternetOption19.csproj
index 864958c..b790054 100644
--- a/UserComponentsOption19/AppShopInternetOption19/AppShopInternetOption19.csproj
+++ b/UserComponentsOption19/AppShopInternetOption19/AppShopInternetOption19.csproj
@@ -11,9 +11,17 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
diff --git a/UserComponentsOption19/AppShopInternetOption19/Forms/FormEdit_Add.Designer.cs b/UserComponentsOption19/AppShopInternetOption19/Forms/FormEdit_Add.Designer.cs
index 046dc0e..d24465a 100644
--- a/UserComponentsOption19/AppShopInternetOption19/Forms/FormEdit_Add.Designer.cs
+++ b/UserComponentsOption19/AppShopInternetOption19/Forms/FormEdit_Add.Designer.cs
@@ -30,11 +30,7 @@
{
textComponentOrderSum = new WinFormsLibrary1.TextComponent();
textBoxName = new TextBox();
- textBoxLastName = new TextBox();
- textBoxPatronymic = new TextBox();
- labelName = new Label();
- labelLastName = new Label();
- labelPatronymic = new Label();
+ labelFIO = new Label();
labelGoodDescription = new Label();
textBoxGoodDescription = new TextBox();
labelOrderSum = new Label();
@@ -44,7 +40,7 @@
//
// textComponentOrderSum
//
- textComponentOrderSum.Location = new Point(653, 144);
+ textComponentOrderSum.Location = new Point(213, -34);
textComponentOrderSum.Margin = new Padding(3, 4, 3, 4);
textComponentOrderSum.Name = "textComponentOrderSum";
textComponentOrderSum.Size = new Size(351, 199);
@@ -53,57 +49,25 @@
//
// textBoxName
//
- textBoxName.Location = new Point(176, 19);
+ textBoxName.Location = new Point(60, 9);
textBoxName.Name = "textBoxName";
- textBoxName.Size = new Size(272, 27);
+ textBoxName.Size = new Size(346, 27);
textBoxName.TabIndex = 1;
//
- // textBoxLastName
+ // labelFIO
//
- textBoxLastName.Location = new Point(176, 62);
- textBoxLastName.Name = "textBoxLastName";
- textBoxLastName.Size = new Size(272, 27);
- textBoxLastName.TabIndex = 2;
- //
- // textBoxPatronymic
- //
- textBoxPatronymic.Location = new Point(176, 109);
- textBoxPatronymic.Name = "textBoxPatronymic";
- textBoxPatronymic.Size = new Size(272, 27);
- textBoxPatronymic.TabIndex = 3;
- //
- // labelName
- //
- labelName.AutoSize = true;
- labelName.Location = new Point(30, 26);
- labelName.Name = "labelName";
- labelName.Size = new Size(39, 20);
- labelName.TabIndex = 4;
- labelName.Text = "Имя";
- //
- // labelLastName
- //
- labelLastName.AutoSize = true;
- labelLastName.Location = new Point(30, 69);
- labelLastName.Name = "labelLastName";
- labelLastName.Size = new Size(73, 20);
- labelLastName.TabIndex = 5;
- labelLastName.Text = "Фамилия";
- //
- // labelPatronymic
- //
- labelPatronymic.AutoSize = true;
- labelPatronymic.Location = new Point(30, 116);
- labelPatronymic.Name = "labelPatronymic";
- labelPatronymic.Size = new Size(72, 20);
- labelPatronymic.TabIndex = 6;
- labelPatronymic.Text = "Отчество";
+ labelFIO.AutoSize = true;
+ labelFIO.Location = new Point(12, 9);
+ labelFIO.Name = "labelFIO";
+ labelFIO.Size = new Size(42, 20);
+ labelFIO.TabIndex = 4;
+ labelFIO.Text = "ФИО";
//
// labelGoodDescription
//
labelGoodDescription.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelGoodDescription.AutoSize = true;
- labelGoodDescription.Location = new Point(626, 26);
+ labelGoodDescription.Location = new Point(433, 16);
labelGoodDescription.Name = "labelGoodDescription";
labelGoodDescription.Size = new Size(131, 20);
labelGoodDescription.TabIndex = 7;
@@ -112,7 +76,7 @@
// textBoxGoodDescription
//
textBoxGoodDescription.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- textBoxGoodDescription.Location = new Point(626, 62);
+ textBoxGoodDescription.Location = new Point(585, 9);
textBoxGoodDescription.Name = "textBoxGoodDescription";
textBoxGoodDescription.Size = new Size(378, 27);
textBoxGoodDescription.TabIndex = 8;
@@ -121,7 +85,7 @@
//
labelOrderSum.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelOrderSum.AutoSize = true;
- labelOrderSum.Location = new Point(653, 264);
+ labelOrderSum.Location = new Point(248, 60);
labelOrderSum.Name = "labelOrderSum";
labelOrderSum.Size = new Size(104, 20);
labelOrderSum.TabIndex = 9;
@@ -131,7 +95,7 @@
//
labelOrderStatus.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelOrderStatus.AutoSize = true;
- labelOrderStatus.Location = new Point(30, 215);
+ labelOrderStatus.Location = new Point(12, 60);
labelOrderStatus.Name = "labelOrderStatus";
labelOrderStatus.Size = new Size(101, 20);
labelOrderStatus.TabIndex = 10;
@@ -139,7 +103,7 @@
//
// selectComponentOrderStatus
//
- selectComponentOrderStatus.Location = new Point(30, 256);
+ selectComponentOrderStatus.Location = new Point(12, 92);
selectComponentOrderStatus.Name = "selectComponentOrderStatus";
selectComponentOrderStatus.SelectedValue = "";
selectComponentOrderStatus.Size = new Size(189, 36);
@@ -155,11 +119,7 @@
Controls.Add(labelOrderSum);
Controls.Add(textBoxGoodDescription);
Controls.Add(labelGoodDescription);
- Controls.Add(labelPatronymic);
- Controls.Add(labelLastName);
- Controls.Add(labelName);
- Controls.Add(textBoxPatronymic);
- Controls.Add(textBoxLastName);
+ Controls.Add(labelFIO);
Controls.Add(textBoxName);
Controls.Add(textComponentOrderSum);
Name = "FormEdit_Add";
@@ -174,7 +134,7 @@
private TextBox textBoxName;
private TextBox textBoxLastName;
private TextBox textBoxPatronymic;
- private Label labelName;
+ private Label labelFIO;
private Label labelLastName;
private Label labelPatronymic;
private Label labelGoodDescription;
diff --git a/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.Designer.cs b/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.Designer.cs
index b20f3a1..7ad77e5 100644
--- a/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.Designer.cs
+++ b/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.Designer.cs
@@ -49,6 +49,7 @@
userControlTreeView.SelectedIndex = -1;
userControlTreeView.Size = new Size(1278, 428);
userControlTreeView.TabIndex = 0;
+ userControlTreeView.Load += FormMain_Load;
//
// menuStrip1
//
@@ -65,6 +66,7 @@
добавитьToolStripMenuItem.Name = "добавитьToolStripMenuItem";
добавитьToolStripMenuItem.Size = new Size(90, 24);
добавитьToolStripMenuItem.Text = "Добавить";
+ добавитьToolStripMenuItem.Click += добавитьToolStripMenuItem_Click;
//
// редактироватьToolStripMenuItem
//
@@ -106,6 +108,7 @@
MainMenuStrip = menuStrip1;
Name = "FormMain";
Text = "Главная форма";
+ Load += FormMain_Load;
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
diff --git a/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.cs b/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.cs
index f644f26..07b3af2 100644
--- a/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.cs
+++ b/UserComponentsOption19/AppShopInternetOption19/Forms/FormMain.cs
@@ -1,10 +1,79 @@
+using ShopContracts.BindingModels;
+using ShopContracts.BusinessLogicContracts;
+using ShopDataBaseImplements.Models;
+
namespace AppShopInternetOption19
{
public partial class FormMain : Form
{
- public FormMain()
+
+ private readonly IOrderLogic _orderLogic;
+ private readonly IOrderStatusLogic _orderStatusLogic;
+
+ public FormMain(IOrderLogic orderLogic, IOrderStatusLogic orderStatusLogic)
{
InitializeComponent();
+ _orderLogic = orderLogic;
+ _orderStatusLogic = orderStatusLogic;
+
+ OrderBindingModel order = new OrderBindingModel
+ {
+ FIO = " ",
+ OrderDescription = "Description",
+ OrderStatus = " ",
+ OrderSumm = "20 ",
+ };
+ _orderLogic.Create(order);
+ }
+
+ private void FormMain_Load(object sender, EventArgs e)
+ {
+
+
+
+ }
+
+ private void ToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormEdit_Add));
+ if (!(service is FormEdit_Add form))
+ {
+ return;
+ }
+
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var orders = _orderLogic.ReadList(null);
+ if (orders == null)
+ {
+ return;
+ }
+
+ List<(string PropertyName, bool AlwaysCreateBranch)> hierarchy =
+ [
+ ("OrderStatus", false),
+ ("OrderSumm", false),
+ ("Id", false),
+ ("FIO", false),
+ ];
+
+ userControlTreeView.SetHierarchy(hierarchy);
+ userControlTreeView.SetTreeObjects(orders);
+
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"{ex.Message}");
+ }
+
}
}
}
diff --git a/UserComponentsOption19/AppShopInternetOption19/Forms/SingletonClass.cs b/UserComponentsOption19/AppShopInternetOption19/Forms/SingletonClass.cs
new file mode 100644
index 0000000..4043ea9
--- /dev/null
+++ b/UserComponentsOption19/AppShopInternetOption19/Forms/SingletonClass.cs
@@ -0,0 +1,35 @@
+using ShopContracts.StorageContracts;
+using ShopDataBaseImplements.Implements;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AppShopInternetOption19.Forms
+{
+ public static class SingletonClass
+ {
+ private static IOrderStorage? _orderStorage = null;
+ public static IOrderStorage OrderStorage
+ {
+ get
+ {
+ if (_orderStorage == null)
+ _orderStorage = new OrderStorage();
+ return _orderStorage;
+ }
+ }
+
+ private static IOrderStatusStorage? _orderStatusStorage = null;
+ public static IOrderStatusStorage OrderStatusStorage
+ {
+ get
+ {
+ if (_orderStatusStorage == null)
+ _orderStatusStorage = new OrderStatusStorage();
+ return _orderStatusStorage;
+ }
+ }
+ }
+}
diff --git a/UserComponentsOption19/AppShopInternetOption19/Program.cs b/UserComponentsOption19/AppShopInternetOption19/Program.cs
index ed849a1..80e60d1 100644
--- a/UserComponentsOption19/AppShopInternetOption19/Program.cs
+++ b/UserComponentsOption19/AppShopInternetOption19/Program.cs
@@ -1,7 +1,20 @@
+using AppShopInternetOption19.Forms;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using ShopBusinessLogic;
+using ShopContracts.BusinessLogicContracts;
+using ShopContracts.StorageContracts;
+using ShopDataBaseImplements.Implements;
+
namespace AppShopInternetOption19
{
internal static class Program
{
+ private static ServiceProvider? _serviceProvider;
+
+ ///
+ ///
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
///
/// The main entry point for the application.
///
@@ -11,7 +24,29 @@ namespace AppShopInternetOption19
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormMain());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ //option.AddNLog("nlog.config");
+ });
+
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/UserComponentsOption19/ShopBusinessLogic/OrderLogic.cs b/UserComponentsOption19/ShopBusinessLogic/OrderLogic.cs
index f55ffd5..f9b653c 100644
--- a/UserComponentsOption19/ShopBusinessLogic/OrderLogic.cs
+++ b/UserComponentsOption19/ShopBusinessLogic/OrderLogic.cs
@@ -78,14 +78,10 @@ namespace ShopBusinessLogic
{
return;
}
- if (model.Name == null || string.IsNullOrEmpty(model.Name))
+ if (model.FIO == null || string.IsNullOrEmpty(model.FIO))
{
throw new ArgumentNullException("Что-то с именем клиента - его нет почему-то");
}
- if (model.LastName == null || string.IsNullOrEmpty(model.LastName))
- {
- throw new ArgumentNullException("что-то с фамилией клиента - ее нет почему-то");
- }
if (model.OrderStatus == null || string.IsNullOrEmpty(model.OrderStatus))
{
throw new ArgumentNullException("что-то со статусом заказа - его нет почему-то");
diff --git a/UserComponentsOption19/ShopContracts/BindingModels/OrderBindingModel.cs b/UserComponentsOption19/ShopContracts/BindingModels/OrderBindingModel.cs
index ae2eaff..8a74b6d 100644
--- a/UserComponentsOption19/ShopContracts/BindingModels/OrderBindingModel.cs
+++ b/UserComponentsOption19/ShopContracts/BindingModels/OrderBindingModel.cs
@@ -5,9 +5,7 @@ namespace ShopContracts.BindingModels
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
- public string Name { get; set; } = string.Empty;
- public string LastName { get; set; } = string.Empty;
- public string Patronymic { get; set; } = string.Empty;
+ public string FIO { get; set; } = string.Empty;
public string OrderDescription { get; set; } = string.Empty;
public string OrderStatus { get; set; } = string.Empty;
public string? OrderSumm { get; set; } = "Оплачено скидками";
diff --git a/UserComponentsOption19/ShopContracts/ViewModels/OrderViewModel.cs b/UserComponentsOption19/ShopContracts/ViewModels/OrderViewModel.cs
index 1f961d6..731c2f0 100644
--- a/UserComponentsOption19/ShopContracts/ViewModels/OrderViewModel.cs
+++ b/UserComponentsOption19/ShopContracts/ViewModels/OrderViewModel.cs
@@ -5,9 +5,7 @@ namespace ShopContracts.ViewModels
public class OrderViewModel : IOrderModel
{
public int Id { get; set; }
- public string Name { get; set; } = string.Empty;
- public string LastName { get; set; } = string.Empty;
- public string Patronymic { get; set; } = string.Empty;
+ public string FIO { get; set; } = string.Empty;
public string? OrderDescription { get; set; } = "Оплачено скидками";
public string OrderStatus { get; set; } = string.Empty;
public string? OrderSumm { get; set; } = string.Empty;
diff --git a/UserComponentsOption19/ShopDataBaseImplements/Migrations/20241119173303_MigrationInit.Designer.cs b/UserComponentsOption19/ShopDataBaseImplements/Migrations/20241119173303_MigrationInit.Designer.cs
new file mode 100644
index 0000000..17fffdc
--- /dev/null
+++ b/UserComponentsOption19/ShopDataBaseImplements/Migrations/20241119173303_MigrationInit.Designer.cs
@@ -0,0 +1,74 @@
+//
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using ShopDataBaseImplements;
+
+#nullable disable
+
+namespace ShopDataBaseImplements.Migrations
+{
+ [DbContext(typeof(DataBase))]
+ [Migration("20241119173303_MigrationInit")]
+ partial class MigrationInit
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "9.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("ShopDataBaseImplements.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FIO")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderDescription")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderStatus")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderSumm")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ShopDataBaseImplements.Models.OrderStatus", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("OrderStatuses");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/UserComponentsOption19/ShopDataBaseImplements/Migrations/20241119173303_MigrationInit.cs b/UserComponentsOption19/ShopDataBaseImplements/Migrations/20241119173303_MigrationInit.cs
new file mode 100644
index 0000000..5d82656
--- /dev/null
+++ b/UserComponentsOption19/ShopDataBaseImplements/Migrations/20241119173303_MigrationInit.cs
@@ -0,0 +1,53 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ShopDataBaseImplements.Migrations
+{
+ ///
+ public partial class MigrationInit : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Orders",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ FIO = table.Column(type: "nvarchar(max)", nullable: false),
+ OrderDescription = table.Column(type: "nvarchar(max)", nullable: false),
+ OrderStatus = table.Column(type: "nvarchar(max)", nullable: false),
+ OrderSumm = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Orders", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "OrderStatuses",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_OrderStatuses", x => x.Id);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "OrderStatuses");
+ }
+ }
+}
diff --git a/UserComponentsOption19/ShopDataBaseImplements/Migrations/DataBaseModelSnapshot.cs b/UserComponentsOption19/ShopDataBaseImplements/Migrations/DataBaseModelSnapshot.cs
new file mode 100644
index 0000000..09d2c20
--- /dev/null
+++ b/UserComponentsOption19/ShopDataBaseImplements/Migrations/DataBaseModelSnapshot.cs
@@ -0,0 +1,71 @@
+//
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using ShopDataBaseImplements;
+
+#nullable disable
+
+namespace ShopDataBaseImplements.Migrations
+{
+ [DbContext(typeof(DataBase))]
+ partial class DataBaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "9.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("ShopDataBaseImplements.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FIO")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderDescription")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderStatus")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderSumm")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ShopDataBaseImplements.Models.OrderStatus", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("OrderStatuses");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/UserComponentsOption19/ShopDataBaseImplements/Models/Order.cs b/UserComponentsOption19/ShopDataBaseImplements/Models/Order.cs
index 5d4dd1c..6614638 100644
--- a/UserComponentsOption19/ShopDataBaseImplements/Models/Order.cs
+++ b/UserComponentsOption19/ShopDataBaseImplements/Models/Order.cs
@@ -10,13 +10,7 @@ namespace ShopDataBaseImplements.Models
public int Id { get; set; }
[Required]
- public string Name { get; set; } = string.Empty;
-
- [Required]
- public string LastName { get; set; } = string.Empty;
-
- [Required]
- public string Patronymic { get; set; } = string.Empty;
+ public string FIO { get; set; } = string.Empty;
[Required]
public string OrderDescription { get; set; } = string.Empty;
@@ -24,41 +18,35 @@ namespace ShopDataBaseImplements.Models
[Required]
public string OrderStatus { get; set; } = string.Empty;
- public string? OrderSumm { get; set; } = "оплачено скидками";
+ public string? OrderSumm { get; set; }
public static Order? Create(OrderBindingModel model)
{
return new Order
{
Id = model.Id,
- Name = model.Name,
- LastName = model.LastName,
+ FIO = model.FIO,
OrderDescription = model.OrderDescription,
OrderStatus = model.OrderStatus,
- Patronymic = model.Patronymic,
- OrderSumm = model.OrderSumm,
+ OrderSumm = model.OrderSumm ?? "Оплачено скидками",
};
}
public void Update(OrderBindingModel model)
{
- Name = model.Name;
- LastName = model.LastName;
- Patronymic = model.Patronymic;
+ FIO = model.FIO;
OrderDescription = model.OrderDescription;
OrderStatus = model.OrderStatus;
- OrderSumm = model.OrderSumm;
+ OrderSumm = model.OrderSumm ?? "Оплачено скидками";
}
public OrderViewModel GetViewModel => new()
{
Id = Id,
- Name = Name,
- LastName = LastName,
- Patronymic = Patronymic,
+ FIO = FIO,
OrderDescription = OrderDescription,
OrderStatus = OrderStatus,
- OrderSumm = OrderSumm,
+ OrderSumm = OrderSumm ?? "Оплачено скидками",
};
}
}
diff --git a/UserComponentsOption19/ShopDataModels/Models/IOrderModel.cs b/UserComponentsOption19/ShopDataModels/Models/IOrderModel.cs
index b60d7bd..6ea3903 100644
--- a/UserComponentsOption19/ShopDataModels/Models/IOrderModel.cs
+++ b/UserComponentsOption19/ShopDataModels/Models/IOrderModel.cs
@@ -3,9 +3,7 @@
public interface IOrderModel
{
public int Id { get; set; }
- public string Name { get; set; }
- public string LastName { get; set; }
- public string Patronymic { get; set; }
+ public string FIO { get; set; }
public string OrderDescription { get; set; }
public string OrderStatus { get; set; }
public string OrderSumm { get; set; }