Правки связей миграции

This commit is contained in:
nikbel2004@outlook.com 2024-05-11 23:19:22 +04:00
parent 99f3839cba
commit dd23035e4c
8 changed files with 16 additions and 16 deletions

View File

@ -13,8 +13,8 @@ namespace FurnitureAssemblyContracts.BindingModels
public int Id { get; set; }
public int ClientId { get; set; }
public int? ImplementerId { get; set; }
public int? ImplementerId { get; set; }
public int FurnitureId { get; set; }

View File

@ -17,10 +17,10 @@ namespace FurnitureAssemblyContracts.SearchModels
public int? ClientId { get; set; }
// Для поиска по исполнителю
public int? ImplementerId { get; set; }
public int? ImplementerId { get; set; }
// Два поля для возможности производить выборку
public DateTime? DateFrom { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set;}

View File

@ -23,9 +23,9 @@ namespace FurnitureAssemblyContracts.ViewModels
public int? ImplementerId { get; set; }
[DisplayName("ФИО исполнителя")]
public string ImplementerFIO { get; set; } = string.Empty;
public int FurnitureId { get; set; }
public string ImplementerFIO { get; set; } = string.Empty;
public int FurnitureId { get; set; }
[DisplayName("Изделие")]
public string FurnitureName { get; set; } = string.Empty;

View File

@ -14,7 +14,7 @@ namespace FurnitureAssemblyDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=KatanaNik\SQLEXPRESS;Initial Catalog=FurnitureAssemblyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=FurnitureAssemblyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);

View File

@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace FurnitureAssemblyDatabaseImplement.Migrations
{
[DbContext(typeof(FurnitureAssemblyDatabase))]
[Migration("20240422061349_Initial")]
partial class Initial
[Migration("20240511191901_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -220,7 +220,7 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
.IsRequired();
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.WithMany("Order")
.HasForeignKey("ImplementerId");
b.Navigation("Client");
@ -244,7 +244,7 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
b.Navigation("Order");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace FurnitureAssemblyDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@ -217,7 +217,7 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
.IsRequired();
b.HasOne("FurnitureAssemblyDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.WithMany("Order")
.HasForeignKey("ImplementerId");
b.Navigation("Client");
@ -241,7 +241,7 @@ namespace FurnitureAssemblyDatabaseImplement.Migrations
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
b.Navigation("Order");
});
modelBuilder.Entity("FurnitureAssemblyDatabaseImplement.Models.WorkPiece", b =>

View File

@ -29,7 +29,7 @@ namespace FurnitureAssemblyDatabaseImplement.Models
// Для реализации связи один ко многим с заказами
[ForeignKey("ImplementerId")]
public virtual List<Order> Orders { get; set; } = new();
public virtual List<Order> Order { get; set; } = new();
public static Implementer? Create(ImplementerBindingModel model)
{