This commit is contained in:
ker73rus 2023-05-18 13:15:10 +04:00
parent 7a3294453c
commit 4a5e106532
5 changed files with 318 additions and 6 deletions

View File

@ -6,5 +6,5 @@
} }
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"IPAddress": "http://localhost:5195" "IPAddress": "https://localhost:7028"
} }

View File

@ -0,0 +1,257 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SecureShopDatabaseImplement;
#nullable disable
namespace SecureShopDatabaseImplement.Migrations
{
[DbContext(typeof(SecureShopDatabase))]
[Migration("20230518085919_lll2")]
partial class lll2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Facilities", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("Cost")
.HasColumnType("float");
b.Property<string>("FacilitiesName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Facilitiess");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("SecureId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("SecureId");
b.ToTable("Orders");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Secure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("Price")
.HasColumnType("float");
b.Property<string>("SecureName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Secures");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.SecureFacilities", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("FacilitiesId")
.HasColumnType("int");
b.Property<int>("SecureId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("FacilitiesId");
b.HasIndex("SecureId");
b.ToTable("SecureFacilitiess");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Order", b =>
{
b.HasOne("SecureShopDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SecureShopDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure")
.WithMany("Orders")
.HasForeignKey("SecureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Secure");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.SecureFacilities", b =>
{
b.HasOne("SecureShopDatabaseImplement.Models.Facilities", "Facilities")
.WithMany("SecureFacilitiess")
.HasForeignKey("FacilitiesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure")
.WithMany("Facilitiess")
.HasForeignKey("SecureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Facilities");
b.Navigation("Secure");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Facilities", b =>
{
b.Navigation("SecureFacilitiess");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Secure", b =>
{
b.Navigation("Facilitiess");
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SecureShopDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class lll2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
table: "Orders");
migrationBuilder.AlterColumn<int>(
name: "ImplementerId",
table: "Orders",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
table: "Orders",
column: "ImplementerId",
principalTable: "Implementers",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
table: "Orders");
migrationBuilder.AlterColumn<int>(
name: "ImplementerId",
table: "Orders",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
table: "Orders",
column: "ImplementerId",
principalTable: "Implementers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -115,7 +115,6 @@ namespace SecureShopDatabaseImplement.Migrations
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<int?>("ImplementerId") b.Property<int?>("ImplementerId")
.IsRequired()
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("SecureId") b.Property<int>("SecureId")
@ -194,9 +193,7 @@ namespace SecureShopDatabaseImplement.Migrations
b.HasOne("SecureShopDatabaseImplement.Models.Implementer", "Implementer") b.HasOne("SecureShopDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders") .WithMany("Orders")
.HasForeignKey("ImplementerId") .HasForeignKey("ImplementerId");
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure") b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure")
.WithMany("Orders") .WithMany("Orders")

View File

@ -14,7 +14,6 @@ namespace SecureShopDatabaseImplement.Models
public int SecureId { get; set; } public int SecureId { get; set; }
[Required] [Required]
public int ClientId { get; set; } public int ClientId { get; set; }
[Required]
public int? ImplementerId { get; set; } public int? ImplementerId { get; set; }
[Required] [Required]
public int Count { get; set; } public int Count { get; set; }