доделала бд, остался веб

This commit is contained in:
Kristina 2024-04-29 14:59:29 +04:00
parent c1b4b3b6b8
commit 9365dbc456
4 changed files with 958 additions and 1 deletions

View File

@ -0,0 +1,353 @@
// <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 SchoolDatabase;
#nullable disable
namespace SchoolDatabase.Migrations
{
[DbContext(typeof(SchoolDbContext))]
[Migration("20240429105856_SchoolMigration")]
partial class SchoolMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal>("Duration")
.HasColumnType("decimal (3,1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Coursess");
});
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CoursesId")
.HasColumnType("int");
b.Property<int>("StudyId")
.HasColumnType("int");
b.Property<decimal>("TotalTime")
.HasColumnType("decimal (10,2)");
b.HasKey("Id");
b.HasIndex("CoursesId");
b.HasIndex("StudyId");
b.ToTable("CoursessForStudys");
});
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Custumers");
});
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Items");
});
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ItemId")
.HasColumnType("int");
b.Property<int>("StudyId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ItemId");
b.HasIndex("StudyId");
b.ToTable("ItemForStudys");
});
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CoursesForStudyId")
.HasColumnType("int");
b.Property<DateTime>("DatePayment")
.HasColumnType("date");
b.Property<decimal>("Sum")
.HasColumnType("decimal (10,2)");
b.HasKey("Id");
b.HasIndex("CoursesForStudyId");
b.ToTable("Payments");
});
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CustomerId")
.HasColumnType("int");
b.Property<int>("CustumerId")
.HasColumnType("int");
b.Property<DateTime>("DateCreated")
.HasColumnType("date");
b.Property<DateTime>("DateСompletion")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Studys");
});
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Post")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
{
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
.WithMany("Courses")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
{
b.HasOne("SchoolDatabase.Models.Courses", null)
.WithMany("CoursessForStudy")
.HasForeignKey("CoursesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolDatabase.Models.Study", null)
.WithMany("CoursessForStudy")
.HasForeignKey("StudyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
{
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
.WithMany("Items")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
{
b.HasOne("SchoolDatabase.Models.Item", "Item")
.WithMany("ItemForStudy")
.HasForeignKey("ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolDatabase.Models.Study", "Study")
.WithMany("ItemsForStudy")
.HasForeignKey("StudyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Item");
b.Navigation("Study");
});
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
{
b.HasOne("SchoolDatabase.Models.CoursesForStudy", "CoursesForStudy")
.WithMany("Payments")
.HasForeignKey("CoursesForStudyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CoursesForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
{
b.HasOne("SchoolDatabase.Models.Custumer", "Custumer")
.WithMany("Study")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Custumer");
});
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
{
b.Navigation("CoursessForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
{
b.Navigation("Study");
});
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
{
b.Navigation("ItemForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
{
b.Navigation("CoursessForStudy");
b.Navigation("ItemsForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
{
b.Navigation("Courses");
b.Navigation("Items");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,254 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SchoolDatabase.Migrations
{
/// <inheritdoc />
public partial class SchoolMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Custumers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Custumers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Workers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
FIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Post = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Workers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Studys",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DateCreated = table.Column<DateTime>(type: "date", nullable: false),
DateСompletion = table.Column<DateTime>(type: "date", nullable: false),
CustumerId = table.Column<int>(type: "int", nullable: false),
CustomerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Studys", x => x.Id);
table.ForeignKey(
name: "FK_Studys_Custumers_CustomerId",
column: x => x.CustomerId,
principalTable: "Custumers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Coursess",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
Duration = table.Column<decimal>(type: "decimal(3,1)", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Coursess", x => x.Id);
table.ForeignKey(
name: "FK_Coursess_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.Id);
table.ForeignKey(
name: "FK_Items_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CoursessForStudys",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TotalTime = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
StudyId = table.Column<int>(type: "int", nullable: false),
CoursesId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CoursessForStudys", x => x.Id);
table.ForeignKey(
name: "FK_CoursessForStudys_Coursess_CoursesId",
column: x => x.CoursesId,
principalTable: "Coursess",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CoursessForStudys_Studys_StudyId",
column: x => x.StudyId,
principalTable: "Studys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ItemForStudys",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ItemId = table.Column<int>(type: "int", nullable: false),
StudyId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ItemForStudys", x => x.Id);
table.ForeignKey(
name: "FK_ItemForStudys_Items_ItemId",
column: x => x.ItemId,
principalTable: "Items",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ItemForStudys_Studys_StudyId",
column: x => x.StudyId,
principalTable: "Studys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Payments",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DatePayment = table.Column<DateTime>(type: "date", nullable: false),
Sum = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
CoursesForStudyId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Payments", x => x.Id);
table.ForeignKey(
name: "FK_Payments_CoursessForStudys_CoursesForStudyId",
column: x => x.CoursesForStudyId,
principalTable: "CoursessForStudys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Coursess_WorkerId",
table: "Coursess",
column: "WorkerId");
migrationBuilder.CreateIndex(
name: "IX_CoursessForStudys_CoursesId",
table: "CoursessForStudys",
column: "CoursesId");
migrationBuilder.CreateIndex(
name: "IX_CoursessForStudys_StudyId",
table: "CoursessForStudys",
column: "StudyId");
migrationBuilder.CreateIndex(
name: "IX_ItemForStudys_ItemId",
table: "ItemForStudys",
column: "ItemId");
migrationBuilder.CreateIndex(
name: "IX_ItemForStudys_StudyId",
table: "ItemForStudys",
column: "StudyId");
migrationBuilder.CreateIndex(
name: "IX_Items_WorkerId",
table: "Items",
column: "WorkerId");
migrationBuilder.CreateIndex(
name: "IX_Payments_CoursesForStudyId",
table: "Payments",
column: "CoursesForStudyId");
migrationBuilder.CreateIndex(
name: "IX_Studys_CustomerId",
table: "Studys",
column: "CustomerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ItemForStudys");
migrationBuilder.DropTable(
name: "Payments");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "CoursessForStudys");
migrationBuilder.DropTable(
name: "Coursess");
migrationBuilder.DropTable(
name: "Studys");
migrationBuilder.DropTable(
name: "Workers");
migrationBuilder.DropTable(
name: "Custumers");
}
}
}

View File

@ -0,0 +1,350 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SchoolDatabase;
#nullable disable
namespace SchoolDatabase.Migrations
{
[DbContext(typeof(SchoolDbContext))]
partial class SchoolDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal>("Duration")
.HasColumnType("decimal (3,1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Coursess");
});
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CoursesId")
.HasColumnType("int");
b.Property<int>("StudyId")
.HasColumnType("int");
b.Property<decimal>("TotalTime")
.HasColumnType("decimal (10,2)");
b.HasKey("Id");
b.HasIndex("CoursesId");
b.HasIndex("StudyId");
b.ToTable("CoursessForStudys");
});
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Custumers");
});
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Items");
});
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ItemId")
.HasColumnType("int");
b.Property<int>("StudyId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ItemId");
b.HasIndex("StudyId");
b.ToTable("ItemForStudys");
});
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CoursesForStudyId")
.HasColumnType("int");
b.Property<DateTime>("DatePayment")
.HasColumnType("date");
b.Property<decimal>("Sum")
.HasColumnType("decimal (10,2)");
b.HasKey("Id");
b.HasIndex("CoursesForStudyId");
b.ToTable("Payments");
});
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CustomerId")
.HasColumnType("int");
b.Property<int>("CustumerId")
.HasColumnType("int");
b.Property<DateTime>("DateCreated")
.HasColumnType("date");
b.Property<DateTime>("DateСompletion")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Studys");
});
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Post")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
{
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
.WithMany("Courses")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
{
b.HasOne("SchoolDatabase.Models.Courses", null)
.WithMany("CoursessForStudy")
.HasForeignKey("CoursesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolDatabase.Models.Study", null)
.WithMany("CoursessForStudy")
.HasForeignKey("StudyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
{
b.HasOne("SchoolDatabase.Models.Worker", "Worker")
.WithMany("Items")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SchoolDatabase.Models.ItemForStudy", b =>
{
b.HasOne("SchoolDatabase.Models.Item", "Item")
.WithMany("ItemForStudy")
.HasForeignKey("ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SchoolDatabase.Models.Study", "Study")
.WithMany("ItemsForStudy")
.HasForeignKey("StudyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Item");
b.Navigation("Study");
});
modelBuilder.Entity("SchoolDatabase.Models.Payment", b =>
{
b.HasOne("SchoolDatabase.Models.CoursesForStudy", "CoursesForStudy")
.WithMany("Payments")
.HasForeignKey("CoursesForStudyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CoursesForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
{
b.HasOne("SchoolDatabase.Models.Custumer", "Custumer")
.WithMany("Study")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Custumer");
});
modelBuilder.Entity("SchoolDatabase.Models.Courses", b =>
{
b.Navigation("CoursessForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.CoursesForStudy", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("SchoolDatabase.Models.Custumer", b =>
{
b.Navigation("Study");
});
modelBuilder.Entity("SchoolDatabase.Models.Item", b =>
{
b.Navigation("ItemForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.Study", b =>
{
b.Navigation("CoursessForStudy");
b.Navigation("ItemsForStudy");
});
modelBuilder.Entity("SchoolDatabase.Models.Worker", b =>
{
b.Navigation("Courses");
b.Navigation("Items");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -23,7 +23,7 @@ namespace SchoolDatabase.Models
// Курсы в обучении
[ForeignKey("StudyId")]
public virtual List<ICoursesForStudy> ICoursessForStudy { get; set; } = new();
public virtual List<CoursesForStudy> CoursessForStudy { get; set; } = new();
// Затраты на обучение
[ForeignKey("StudyId")]