diff --git a/AutomobilePlant/AbstractAutoBusinessLogic/BusinessLogics/OrderLogic.cs b/AutomobilePlant/AbstractAutoBusinessLogic/BusinessLogics/OrderLogic.cs
index 5a5ac5c..052f00d 100644
--- a/AutomobilePlant/AbstractAutoBusinessLogic/BusinessLogics/OrderLogic.cs
+++ b/AutomobilePlant/AbstractAutoBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -58,7 +58,7 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
model.Status = newStatus;
if (model.Status == OrderStatus.Выдан)
- model.DateImplement = DateTime.Now;
+ model.DateImplement = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
if (_orderStorage.Update(model) == null)
{
diff --git a/AutomobilePlant/AbstractAutoContracts/BindingModels/OrderBindingModel.cs b/AutomobilePlant/AbstractAutoContracts/BindingModels/OrderBindingModel.cs
index 00bad8b..efba5ea 100644
--- a/AutomobilePlant/AbstractAutoContracts/BindingModels/OrderBindingModel.cs
+++ b/AutomobilePlant/AbstractAutoContracts/BindingModels/OrderBindingModel.cs
@@ -16,7 +16,7 @@ namespace AutomobilePlantContracts.BindingModels
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
- public DateTime DateCreate { get; set; } = DateTime.Now;
+ public DateTime DateCreate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
public DateTime? DateImplement { get; set; }
}
}
diff --git a/AutomobilePlant/AbstractAutoContracts/ViewModel/OrderViewModel.cs b/AutomobilePlant/AbstractAutoContracts/ViewModel/OrderViewModel.cs
index 70368cc..4c61020 100644
--- a/AutomobilePlant/AbstractAutoContracts/ViewModel/OrderViewModel.cs
+++ b/AutomobilePlant/AbstractAutoContracts/ViewModel/OrderViewModel.cs
@@ -23,7 +23,7 @@ namespace AutomobilePlantContracts.ViewModel
[DisplayName("Статус")]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Дата создания")]
- public DateTime DateCreate { get; set; } = DateTime.Now;
+ public DateTime DateCreate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
[DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; }
diff --git a/AutomobilePlant/AutomobilePlant/AutomobilePlant.csproj b/AutomobilePlant/AutomobilePlant/AutomobilePlant.csproj
index cf7ebd2..0044891 100644
--- a/AutomobilePlant/AutomobilePlant/AutomobilePlant.csproj
+++ b/AutomobilePlant/AutomobilePlant/AutomobilePlant.csproj
@@ -28,7 +28,7 @@
-
+
\ No newline at end of file
diff --git a/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/20230419145215_InitialMigration.Designer.cs b/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/20230419145215_InitialMigration.Designer.cs
new file mode 100644
index 0000000..be9d525
--- /dev/null
+++ b/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/20230419145215_InitialMigration.Designer.cs
@@ -0,0 +1,175 @@
+//
+using System;
+using AutomobilePlantDataBaseImplements;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace AutomobilePlantDataBaseImplements.Migrations
+{
+ [DbContext(typeof(AutoPlantDataBase))]
+ [Migration("20230419145215_InitialMigration")]
+ partial class InitialMigration
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.5")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Car", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CarName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Price")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Cars");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.CarComponent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CarId")
+ .HasColumnType("integer");
+
+ b.Property("ComponentId")
+ .HasColumnType("integer");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CarId");
+
+ b.HasIndex("ComponentId");
+
+ b.ToTable("CarComponents");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Component", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ComponentName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Cost")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Components");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CarId")
+ .HasColumnType("integer");
+
+ b.Property("CarName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.Property("DateCreate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateImplement")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("Sum")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CarId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.CarComponent", b =>
+ {
+ b.HasOne("AutomobilePlantDataBaseImplements.Models.Car", "Car")
+ .WithMany("Components")
+ .HasForeignKey("CarId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AutomobilePlantDataBaseImplements.Models.Component", "Component")
+ .WithMany("CarComponents")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Car");
+
+ b.Navigation("Component");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Order", b =>
+ {
+ b.HasOne("AutomobilePlantDataBaseImplements.Models.Car", "car")
+ .WithMany("Orders")
+ .HasForeignKey("CarId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("car");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Car", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Component", b =>
+ {
+ b.Navigation("CarComponents");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/20230419145215_InitialMigration.cs b/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/20230419145215_InitialMigration.cs
new file mode 100644
index 0000000..bb0d9c1
--- /dev/null
+++ b/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/20230419145215_InitialMigration.cs
@@ -0,0 +1,127 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace AutomobilePlantDataBaseImplements.Migrations
+{
+ ///
+ public partial class InitialMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Cars",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ CarName = table.Column(type: "text", nullable: false),
+ Price = table.Column(type: "double precision", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Cars", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Components",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ ComponentName = table.Column(type: "text", nullable: false),
+ Cost = table.Column(type: "double precision", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Components", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Orders",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ CarId = table.Column(type: "integer", nullable: false),
+ CarName = table.Column(type: "text", nullable: false),
+ Count = table.Column(type: "integer", nullable: false),
+ Sum = table.Column(type: "double precision", nullable: false),
+ Status = table.Column(type: "integer", nullable: false),
+ DateCreate = table.Column(type: "timestamp with time zone", nullable: false),
+ DateImplement = table.Column(type: "timestamp with time zone", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Orders", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Orders_Cars_CarId",
+ column: x => x.CarId,
+ principalTable: "Cars",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "CarComponents",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ CarId = table.Column(type: "integer", nullable: false),
+ ComponentId = table.Column(type: "integer", nullable: false),
+ Count = table.Column(type: "integer", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_CarComponents", x => x.Id);
+ table.ForeignKey(
+ name: "FK_CarComponents_Cars_CarId",
+ column: x => x.CarId,
+ principalTable: "Cars",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_CarComponents_Components_ComponentId",
+ column: x => x.ComponentId,
+ principalTable: "Components",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_CarComponents_CarId",
+ table: "CarComponents",
+ column: "CarId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_CarComponents_ComponentId",
+ table: "CarComponents",
+ column: "ComponentId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Orders_CarId",
+ table: "Orders",
+ column: "CarId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "CarComponents");
+
+ migrationBuilder.DropTable(
+ name: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "Components");
+
+ migrationBuilder.DropTable(
+ name: "Cars");
+ }
+ }
+}
diff --git a/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/AutoPlantDataBaseModelSnapshot.cs b/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/AutoPlantDataBaseModelSnapshot.cs
new file mode 100644
index 0000000..8dd1c29
--- /dev/null
+++ b/AutomobilePlant/AutomobilePlantDataBaseImplements/Migrations/AutoPlantDataBaseModelSnapshot.cs
@@ -0,0 +1,172 @@
+//
+using System;
+using AutomobilePlantDataBaseImplements;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace AutomobilePlantDataBaseImplements.Migrations
+{
+ [DbContext(typeof(AutoPlantDataBase))]
+ partial class AutoPlantDataBaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.5")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Car", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CarName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Price")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Cars");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.CarComponent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CarId")
+ .HasColumnType("integer");
+
+ b.Property("ComponentId")
+ .HasColumnType("integer");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CarId");
+
+ b.HasIndex("ComponentId");
+
+ b.ToTable("CarComponents");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Component", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ComponentName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Cost")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Components");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CarId")
+ .HasColumnType("integer");
+
+ b.Property("CarName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.Property("DateCreate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateImplement")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("Sum")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CarId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.CarComponent", b =>
+ {
+ b.HasOne("AutomobilePlantDataBaseImplements.Models.Car", "Car")
+ .WithMany("Components")
+ .HasForeignKey("CarId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AutomobilePlantDataBaseImplements.Models.Component", "Component")
+ .WithMany("CarComponents")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Car");
+
+ b.Navigation("Component");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Order", b =>
+ {
+ b.HasOne("AutomobilePlantDataBaseImplements.Models.Car", "car")
+ .WithMany("Orders")
+ .HasForeignKey("CarId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("car");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Car", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("AutomobilePlantDataBaseImplements.Models.Component", b =>
+ {
+ b.Navigation("CarComponents");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}