diff --git a/FishFactory/FishFactory.csproj b/FishFactory/FishFactory.csproj
index 8e250dc..e239476 100644
--- a/FishFactory/FishFactory.csproj
+++ b/FishFactory/FishFactory.csproj
@@ -45,6 +45,9 @@
Always
+
+ Always
+
Always
diff --git a/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs b/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs
index ca2a6a9..3606c2c 100644
--- a/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs
+++ b/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs
@@ -81,8 +81,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
public bool TakeOrderInWork(OrderBindingModel model)
{
- return ToNextStatus(model, OrderStatus.Выполняется);
- }
+ return ToNextStatus(model, OrderStatus.Выполняется);
+ }
public bool FinishOrder(OrderBindingModel model)
{
@@ -106,15 +106,21 @@ namespace FishFactoryBusinessLogic.BusinessLogic
throw new ArgumentNullException(nameof(element));
}
- model.CannedId = element.CannedId;
+ if (element.ImplementerId != null && model.ImplementerId != null && model.ImplementerId != element.ImplementerId)
+ {
+ throw new InvalidOperationException(nameof(model.ImplementerId));
+ }
+
+ model.CannedId = element.CannedId;
model.ClientId = element.ClientId;
model.DateCreate = element.DateCreate;
model.DateImplement = element.DateImplement;
model.Status = element.Status;
model.Count = element.Count;
model.Sum = element.Sum;
+ model.ImplementerId = element.ImplementerId.HasValue ? element.ImplementerId : model.ImplementerId;
- if (model.Status != orderStatus - 1)
+ if (model.Status != orderStatus - 1)
{
_logger.LogWarning("Status update to " + orderStatus + " operation failed");
return false;
diff --git a/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs b/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs
index 73eada3..1a59259 100644
--- a/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs
+++ b/FishFactoryBusinessLogic/BusinessLogic/WorkModeling.cs
@@ -31,9 +31,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
return;
}
var orders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Принят });
- var processingOrders = _orderLogic.ReadList(new OrderSearchModel { Status = OrderStatus.Выполняется });
- if (orders == null || processingOrders == null || (orders.Count == 0 && processingOrders.Count == 0))
+ if (orders == null || orders.Count == 0)
{
_logger.LogWarning("DoWork. Orders is null or empty");
return;
@@ -78,7 +77,8 @@ namespace FishFactoryBusinessLogic.BusinessLogic
{
Id = order.Id
});
- }
+ Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
+ }
// кто-то мог уже перехватить заказ, игнорируем ошибку
catch (InvalidOperationException ex)
{
@@ -91,7 +91,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
throw;
}
// отдыхаем
- Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
+
}
});
}
@@ -104,7 +104,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
}
try
{
- var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
+ var runOrder = await Task.Run(() => _orderLogic.ReadElement(new()
{
ImplementerId = implementer.Id,
Status = OrderStatus.Выполняется
diff --git a/FishFactoryContracts/BusinessLogicsContracts/IOrderLogic.cs b/FishFactoryContracts/BusinessLogicsContracts/IOrderLogic.cs
index c7154e0..8391391 100644
--- a/FishFactoryContracts/BusinessLogicsContracts/IOrderLogic.cs
+++ b/FishFactoryContracts/BusinessLogicsContracts/IOrderLogic.cs
@@ -1,11 +1,6 @@
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.SearchModels;
using FishFactoryContracts.ViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace FishFactoryContracts.BusinessLogicsContracts
{
diff --git a/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs b/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs
index be9c97f..ec31f76 100644
--- a/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs
+++ b/FishFactoryContracts/SearchModels/ImplementerSearchModel.cs
@@ -4,7 +4,7 @@ namespace FishFactoryContracts.SearchModels
public class ImplementerSearchModel
{
public int? Id { get; set; }
- public string? ImplementerFIO { get; set; }
- public string? Password { get; set; }
- }
+ public string? ImplementerFIO { get; set; } = string.Empty;
+ public string? Password { get; set; } = string.Empty;
+ }
}
diff --git a/FishFactoryContracts/ViewModels/ImplementerViewModel.cs b/FishFactoryContracts/ViewModels/ImplementerViewModel.cs
index ceaae40..6c8008a 100644
--- a/FishFactoryContracts/ViewModels/ImplementerViewModel.cs
+++ b/FishFactoryContracts/ViewModels/ImplementerViewModel.cs
@@ -1,9 +1,9 @@
-
+using FishFactoryDataModel.Models;
using System.ComponentModel;
namespace FishFactoryContracts.ViewModels
{
- public class ImplementerViewModel
+ public class ImplementerViewModel : IImplementerModel
{
public int Id { get; set; }
[DisplayName("ФИО исполнителя")]
diff --git a/FishFactoryDatabaseImplement/Implements/ImplementerStorage.cs b/FishFactoryDatabaseImplement/Implements/ImplementerStorage.cs
index b3edfd7..47eed17 100644
--- a/FishFactoryDatabaseImplement/Implements/ImplementerStorage.cs
+++ b/FishFactoryDatabaseImplement/Implements/ImplementerStorage.cs
@@ -26,9 +26,9 @@ namespace FishFactoryDatabaseImplement.Implements
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
{
- if (string.IsNullOrEmpty(model.ImplementerFIO) && string.IsNullOrEmpty(model.Password) &&
+ if (string.IsNullOrEmpty(model.ImplementerFIO) && string.IsNullOrEmpty(model.Password) &&
!model.Id.HasValue)
- {
+ {
return null;
}
using var context = new FishFactoryDatabase();
diff --git a/FishFactoryDatabaseImplement/Implements/OrderStorage.cs b/FishFactoryDatabaseImplement/Implements/OrderStorage.cs
index 98122e0..aa04722 100644
--- a/FishFactoryDatabaseImplement/Implements/OrderStorage.cs
+++ b/FishFactoryDatabaseImplement/Implements/OrderStorage.cs
@@ -22,7 +22,7 @@ namespace FishFactoryDatabaseImplement.Implements
public List GetFilteredList(OrderSearchModel model)
{
using var context = new FishFactoryDatabase();
- return context.Orders
+ return context.Orders
.Include(x => x.Canned)
.Include(x => x.Client)
.Include(x => x.Implementer)
@@ -43,7 +43,7 @@ namespace FishFactoryDatabaseImplement.Implements
return null;
}
using var context = new FishFactoryDatabase();
- return context.Orders
+ return context.Orders
.Include(x => x.Canned)
.Include(x => x.Client)
.Include(x => x.Implementer)
diff --git a/FishFactoryDatabaseImplement/Migrations/20240514140738_implementer.Designer.cs b/FishFactoryDatabaseImplement/Migrations/20240514140738_implementer.Designer.cs
new file mode 100644
index 0000000..6915550
--- /dev/null
+++ b/FishFactoryDatabaseImplement/Migrations/20240514140738_implementer.Designer.cs
@@ -0,0 +1,252 @@
+//
+using System;
+using FishFactoryDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace FishFactoryDatabaseImplement.Migrations
+{
+ [DbContext(typeof(FishFactoryDatabase))]
+ [Migration("20240514140738_implementer")]
+ partial class implementer
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.16")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CannedName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Price")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Canneds");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedComponent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CannedId")
+ .HasColumnType("integer");
+
+ b.Property("ComponentId")
+ .HasColumnType("integer");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CannedId");
+
+ b.HasIndex("ComponentId");
+
+ b.ToTable("CannedComponents");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientFIO")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.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("FishFactoryDatabaseImplement.Models.Implementer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ImplementerFIO")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Qualification")
+ .HasColumnType("integer");
+
+ b.Property("WorkExperience")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Implementers");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CannedId")
+ .HasColumnType("integer");
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.Property("DateCreate")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DateImplement")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("ImplementerId")
+ .HasColumnType("integer");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("Sum")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CannedId");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("ImplementerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedComponent", b =>
+ {
+ b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned")
+ .WithMany("Components")
+ .HasForeignKey("CannedId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("FishFactoryDatabaseImplement.Models.Component", "Component")
+ .WithMany("CannedComponents")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Canned");
+
+ b.Navigation("Component");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned")
+ .WithMany("Orders")
+ .HasForeignKey("CannedId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("FishFactoryDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("FishFactoryDatabaseImplement.Models.Implementer", "Implementer")
+ .WithMany("Order")
+ .HasForeignKey("ImplementerId");
+
+ b.Navigation("Canned");
+
+ b.Navigation("Client");
+
+ b.Navigation("Implementer");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Component", b =>
+ {
+ b.Navigation("CannedComponents");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Implementer", b =>
+ {
+ b.Navigation("Order");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/FishFactoryDatabaseImplement/Migrations/20240514140738_implementer.cs b/FishFactoryDatabaseImplement/Migrations/20240514140738_implementer.cs
new file mode 100644
index 0000000..b171c71
--- /dev/null
+++ b/FishFactoryDatabaseImplement/Migrations/20240514140738_implementer.cs
@@ -0,0 +1,22 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace FishFactoryDatabaseImplement.Migrations
+{
+ ///
+ public partial class implementer : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/FishFactoryDatabaseImplement/Migrations/20240514143630_implementer2.Designer.cs b/FishFactoryDatabaseImplement/Migrations/20240514143630_implementer2.Designer.cs
new file mode 100644
index 0000000..ac347b6
--- /dev/null
+++ b/FishFactoryDatabaseImplement/Migrations/20240514143630_implementer2.Designer.cs
@@ -0,0 +1,252 @@
+//
+using System;
+using FishFactoryDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace FishFactoryDatabaseImplement.Migrations
+{
+ [DbContext(typeof(FishFactoryDatabase))]
+ [Migration("20240514143630_implementer2")]
+ partial class implementer2
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.16")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CannedName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Price")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("Canneds");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedComponent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CannedId")
+ .HasColumnType("integer");
+
+ b.Property("ComponentId")
+ .HasColumnType("integer");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CannedId");
+
+ b.HasIndex("ComponentId");
+
+ b.ToTable("CannedComponents");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientFIO")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.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("FishFactoryDatabaseImplement.Models.Implementer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ImplementerFIO")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Qualification")
+ .HasColumnType("integer");
+
+ b.Property("WorkExperience")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Implementers");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CannedId")
+ .HasColumnType("integer");
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Count")
+ .HasColumnType("integer");
+
+ b.Property("DateCreate")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("DateImplement")
+ .HasColumnType("timestamp without time zone");
+
+ b.Property("ImplementerId")
+ .HasColumnType("integer");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("Sum")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CannedId");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("ImplementerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.CannedComponent", b =>
+ {
+ b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned")
+ .WithMany("Components")
+ .HasForeignKey("CannedId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("FishFactoryDatabaseImplement.Models.Component", "Component")
+ .WithMany("CannedComponents")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Canned");
+
+ b.Navigation("Component");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("FishFactoryDatabaseImplement.Models.Canned", "Canned")
+ .WithMany("Orders")
+ .HasForeignKey("CannedId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("FishFactoryDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("FishFactoryDatabaseImplement.Models.Implementer", "Implementer")
+ .WithMany("Order")
+ .HasForeignKey("ImplementerId");
+
+ b.Navigation("Canned");
+
+ b.Navigation("Client");
+
+ b.Navigation("Implementer");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Canned", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Component", b =>
+ {
+ b.Navigation("CannedComponents");
+ });
+
+ modelBuilder.Entity("FishFactoryDatabaseImplement.Models.Implementer", b =>
+ {
+ b.Navigation("Order");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/FishFactoryDatabaseImplement/Migrations/20240514143630_implementer2.cs b/FishFactoryDatabaseImplement/Migrations/20240514143630_implementer2.cs
new file mode 100644
index 0000000..7105be2
--- /dev/null
+++ b/FishFactoryDatabaseImplement/Migrations/20240514143630_implementer2.cs
@@ -0,0 +1,22 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace FishFactoryDatabaseImplement.Migrations
+{
+ ///
+ public partial class implementer2 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/FishFactoryDatabaseImplement/Models/Implementer.cs b/FishFactoryDatabaseImplement/Models/Implementer.cs
index 7a5c70c..dd3193e 100644
--- a/FishFactoryDatabaseImplement/Models/Implementer.cs
+++ b/FishFactoryDatabaseImplement/Models/Implementer.cs
@@ -1,6 +1,7 @@
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.ViewModels;
using FishFactoryDataModel.Models;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FishFactoryDatabaseImplement.Models
@@ -8,15 +9,15 @@ namespace FishFactoryDatabaseImplement.Models
public class Implementer : IImplementerModel
{
public int Id { get; private set; }
-
- public string ImplementerFIO { get; private set; } = string.Empty;
-
- public string Password { get; private set; } = string.Empty;
-
- public int WorkExperience { get; private set; } = 0;
-
- public int Qualification { get; private set; } = 0;
- [ForeignKey("ImplementerId")]
+ [Required]
+ public string ImplementerFIO { get; private set; } = string.Empty;
+ [Required]
+ public string Password { get; private set; } = string.Empty;
+ [Required]
+ public int WorkExperience { get; private set; } = 0;
+ [Required]
+ public int Qualification { get; private set; } = 0;
+ [ForeignKey("ImplementerId")]
public virtual List Order { get; set; } = new();
public static Implementer? Create(ImplementerBindingModel? model)
diff --git a/FishFactoryDatabaseImplement/Models/Order.cs b/FishFactoryDatabaseImplement/Models/Order.cs
index 64e66f3..4ec0420 100644
--- a/FishFactoryDatabaseImplement/Models/Order.cs
+++ b/FishFactoryDatabaseImplement/Models/Order.cs
@@ -40,6 +40,7 @@ namespace FishFactoryDatabaseImplement.Models
Client = context.Clients.First(x => x.Id == model.ClientId),
ImplementerId = model.ImplementerId,
Implementer = model.ImplementerId == null ? null : context.Implementers.First(i => i.Id == model.ImplementerId),
+
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@@ -55,14 +56,8 @@ namespace FishFactoryDatabaseImplement.Models
}
using var context = new FishFactoryDatabase();
- Id = model.Id;
- CannedId = model.CannedId;
- ClientId = model.ClientId;
ImplementerId = model.ImplementerId;
- Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null;
- Sum = model.Sum;
Status = model.Status;
- DateCreate = model.DateCreate;
DateImplement = model.DateImplement;
}
public OrderViewModel GetViewModel => new()