diff --git a/DepartmentPortal/Common/DatabaseCore/AbstractGenerticEntityService.cs b/DepartmentPortal/Common/DatabaseCore/AbstractGenerticEntityService.cs
index ed691a6..057681f 100644
--- a/DepartmentPortal/Common/DatabaseCore/AbstractGenerticEntityService.cs
+++ b/DepartmentPortal/Common/DatabaseCore/AbstractGenerticEntityService.cs
@@ -68,7 +68,7 @@ namespace DatabaseCore
return OperationResultModel.Error("Error:", "Элемент был удален", ResultServiceStatusCode.WasDelete);
}
- var result = AdditionalCheckingWhenDeleting(context, model);
+ var result = AdditionalCheckingWhenDeleting(context, entity, model);
if (!result.IsSucceeded)
{
return result;
@@ -79,7 +79,7 @@ namespace DatabaseCore
context.SaveChanges();
- AdditionalDeleting(context, model);
+ AdditionalDeleting(context, entity, model);
transaction.Commit();
}
@@ -186,7 +186,7 @@ namespace DatabaseCore
///
///
///
- protected abstract OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, G model);
+ protected abstract OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, T entity, G model);
///
/// Добавление дополнительных фильтров
@@ -206,7 +206,7 @@ namespace DatabaseCore
/// Дополнительные удаления зависимых сущностей
///
///
- protected abstract void AdditionalDeleting(DbContext context, G model);
+ protected abstract void AdditionalDeleting(DbContext context, T entity, G model);
///
/// Установка сортировок
diff --git a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs
index 0bce762..ed79386 100644
--- a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs
+++ b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs
@@ -32,7 +32,7 @@ namespace DatabaseCore
modelBuilder.Entity().HasIndex(s => s.UserName);
- modelBuilder.Entity().HasIndex(s => s.EmployeePostName).IsUnique();
+ modelBuilder.Entity().HasIndex(s => s.PostName).IsUnique();
modelBuilder.Entity().HasIndex(p => new { p.FirstName, p.LastName, p.Patronymic }).IsUnique();
@@ -46,8 +46,6 @@ namespace DatabaseCore
modelBuilder.Entity().HasIndex(p => new { p.LecturerAcademicRankName }).IsUnique();
- modelBuilder.Entity().HasIndex(p => new { p.LecturerPostName }).IsUnique();
-
modelBuilder.Entity().HasIndex(p => new { p.FirstName, p.LastName, p.Patronymic }).IsUnique();
}
@@ -60,15 +58,14 @@ namespace DatabaseCore
#endregion
#region Department
- public virtual DbSet EmployeePosts { set; get; }
+ public virtual DbSet Posts { set; get; }
public virtual DbSet Employees { set; get; }
- public virtual DbSet EmployeeEmployeePosts { set; get; }
+ public virtual DbSet EmployeePosts { set; get; }
public virtual DbSet Classrooms { set; get; }
public virtual DbSet DisciplineBlocks { set; get; }
public virtual DbSet Disciplines { set; get; }
public virtual DbSet LecturerAcademicDegrees { set; get; }
public virtual DbSet LecturerAcademicRanks { set; get; }
- public virtual DbSet LecturerEmployeePosts { set; get; }
public virtual DbSet LecturerPosts { set; get; }
public virtual DbSet Lecturers { set; get; }
#endregion
diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210405080239_RemLecturerPost.Designer.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210405080239_RemLecturerPost.Designer.cs
new file mode 100644
index 0000000..dd68b65
--- /dev/null
+++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210405080239_RemLecturerPost.Designer.cs
@@ -0,0 +1,810 @@
+//
+using System;
+using DatabaseCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace DatabaseCore.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20210405080239_RemLecturerPost")]
+ partial class RemLecturerPost
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Classroom", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Capacity")
+ .HasColumnType("int");
+
+ b.Property("ClassroomType")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("EmployeeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("HaveProjector")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Number")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Photo")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("SecurityCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Square")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Title")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EmployeeId");
+
+ b.HasIndex("Number")
+ .IsUnique()
+ .HasFilter("[Number] IS NOT NULL");
+
+ b.ToTable("Classrooms");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Discipline", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisciplineBlockId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisciplineBlueAsteriskName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisciplineName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("DisciplineShortName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DisciplineBlockId");
+
+ b.HasIndex("DisciplineName")
+ .IsUnique();
+
+ b.ToTable("Disciplines");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.DisciplineBlock", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("DisciplineBlockBlueAsteriskName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisciplineBlockOrder")
+ .HasColumnType("int");
+
+ b.Property("DisciplineBlockUseForGrouping")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Title")
+ .IsUnique();
+
+ b.ToTable("DisciplineBlocks");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Address")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DateBirth")
+ .HasColumnType("datetime2");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("GroupElectricalSafety")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HomeNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MobileNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Patronymic")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Photo")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("FirstName", "LastName", "Patronymic")
+ .IsUnique()
+ .HasFilter("[FirstName] IS NOT NULL AND [LastName] IS NOT NULL AND [Patronymic] IS NOT NULL");
+
+ b.ToTable("Employees");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("EmployeeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsExternalCombination")
+ .HasColumnType("bit");
+
+ b.Property("IsInternalCombination")
+ .HasColumnType("bit");
+
+ b.Property("PostId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Rate")
+ .HasColumnType("decimal(18,2)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EmployeeId");
+
+ b.HasIndex("PostId");
+
+ b.ToTable("EmployeePosts");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Abbreviation")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Address")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DateBirth")
+ .HasColumnType("datetime2");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("HomeNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("LecturerAcademicDegreeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LecturerAcademicRankId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LecturerPostId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LecturerPostRate")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("MobileNumber")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OnlyForPrivate")
+ .HasColumnType("bit");
+
+ b.Property("Patronymic")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Photo")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LecturerAcademicDegreeId");
+
+ b.HasIndex("LecturerAcademicRankId");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("FirstName", "LastName", "Patronymic")
+ .IsUnique()
+ .HasFilter("[Patronymic] IS NOT NULL");
+
+ b.ToTable("Lecturers");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LecturerAcademicDegreeName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LecturerAcademicDegreeName")
+ .IsUnique();
+
+ b.ToTable("LecturerAcademicDegrees");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LecturerAcademicRankName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LecturerAcademicRankName")
+ .IsUnique();
+
+ b.ToTable("LecturerAcademicRanks");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsExternalCombination")
+ .HasColumnType("bit");
+
+ b.Property("IsInternalCombination")
+ .HasColumnType("bit");
+
+ b.Property("LecturerId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PostId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Rate")
+ .HasColumnType("decimal(18,2)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LecturerId");
+
+ b.HasIndex("PostId");
+
+ b.ToTable("LecturerPosts");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Post", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Hours")
+ .HasColumnType("int");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("PostName")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PostName")
+ .IsUnique()
+ .HasFilter("[PostName] IS NOT NULL");
+
+ b.ToTable("Posts");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AccessOperation")
+ .HasColumnType("int");
+
+ b.Property("AccessType")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("Accesses");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.EnviromentSetting", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Key")
+ .IsUnique();
+
+ b.ToTable("EnviromentSettings");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("RoleName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RolePriority")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleName")
+ .IsUnique();
+
+ b.ToTable("Roles");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Avatar")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("CountAttempt")
+ .HasColumnType("int");
+
+ b.Property("DateBanned")
+ .HasColumnType("datetime2");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("DateLastVisit")
+ .HasColumnType("datetime2");
+
+ b.Property("IsBanned")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("PasswordHash")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserName");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("RoleId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserRoles");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Classroom", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Department.Employee", "Employee")
+ .WithMany("Classrooms")
+ .HasForeignKey("EmployeeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Discipline", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Department.DisciplineBlock", "DisciplineBlock")
+ .WithMany("Disciplines")
+ .HasForeignKey("DisciplineBlockId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DisciplineBlock");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Security.User", "User")
+ .WithMany("Employees")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Department.Employee", "Employee")
+ .WithMany("EmployeePosts")
+ .HasForeignKey("EmployeeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseCore.Models.Department.Post", "Post")
+ .WithMany("EmployeePosts")
+ .HasForeignKey("PostId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+
+ b.Navigation("Post");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Department.LecturerAcademicDegree", "LecturerAcademicDegree")
+ .WithMany("Lecturers")
+ .HasForeignKey("LecturerAcademicDegreeId");
+
+ b.HasOne("DatabaseCore.Models.Department.LecturerAcademicRank", "LecturerAcademicRank")
+ .WithMany("Lecturers")
+ .HasForeignKey("LecturerAcademicRankId");
+
+ b.HasOne("DatabaseCore.Models.Security.User", "User")
+ .WithMany("Lecturers")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("LecturerAcademicDegree");
+
+ b.Navigation("LecturerAcademicRank");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer")
+ .WithMany("LecturerPosts")
+ .HasForeignKey("LecturerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseCore.Models.Department.Post", "Post")
+ .WithMany("LecturerPosts")
+ .HasForeignKey("PostId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Lecturer");
+
+ b.Navigation("Post");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Security.Role", "Role")
+ .WithMany("Access")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
+ {
+ b.HasOne("DatabaseCore.Models.Security.Role", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("DatabaseCore.Models.Security.User", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.DisciplineBlock", b =>
+ {
+ b.Navigation("Disciplines");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
+ {
+ b.Navigation("Classrooms");
+
+ b.Navigation("EmployeePosts");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b =>
+ {
+ b.Navigation("LecturerPosts");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b =>
+ {
+ b.Navigation("Lecturers");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", b =>
+ {
+ b.Navigation("Lecturers");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Post", b =>
+ {
+ b.Navigation("EmployeePosts");
+
+ b.Navigation("LecturerPosts");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
+ {
+ b.Navigation("Access");
+
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
+ {
+ b.Navigation("Employees");
+
+ b.Navigation("Lecturers");
+
+ b.Navigation("UserRoles");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210405080239_RemLecturerPost.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210405080239_RemLecturerPost.cs
new file mode 100644
index 0000000..236e0db
--- /dev/null
+++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210405080239_RemLecturerPost.cs
@@ -0,0 +1,419 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace DatabaseCore.Migrations
+{
+ public partial class RemLecturerPost : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Lecturers_LecturerPosts_LecturerPostId",
+ table: "Lecturers");
+
+ migrationBuilder.DropTable(
+ name: "EmployeeEmployeePosts");
+
+ migrationBuilder.DropTable(
+ name: "LecturerEmployeePosts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Lecturers_LecturerPostId",
+ table: "Lecturers");
+
+ migrationBuilder.DropIndex(
+ name: "IX_LecturerPosts_LecturerPostName",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_EmployeePosts_EmployeePostName",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "Hours",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "LecturerPostName",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "Order",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "EmployeePostName",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "Order",
+ table: "EmployeePosts");
+
+ migrationBuilder.AddColumn(
+ name: "IsExternalCombination",
+ table: "LecturerPosts",
+ type: "bit",
+ nullable: false,
+ defaultValue: false);
+
+ migrationBuilder.AddColumn(
+ name: "IsInternalCombination",
+ table: "LecturerPosts",
+ type: "bit",
+ nullable: false,
+ defaultValue: false);
+
+ migrationBuilder.AddColumn(
+ name: "LecturerId",
+ table: "LecturerPosts",
+ type: "uniqueidentifier",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
+
+ migrationBuilder.AddColumn(
+ name: "PostId",
+ table: "LecturerPosts",
+ type: "uniqueidentifier",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
+
+ migrationBuilder.AddColumn(
+ name: "Rate",
+ table: "LecturerPosts",
+ type: "decimal(18,2)",
+ nullable: false,
+ defaultValue: 0m);
+
+ migrationBuilder.AddColumn(
+ name: "EmployeeId",
+ table: "EmployeePosts",
+ type: "uniqueidentifier",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
+
+ migrationBuilder.AddColumn(
+ name: "IsExternalCombination",
+ table: "EmployeePosts",
+ type: "bit",
+ nullable: false,
+ defaultValue: false);
+
+ migrationBuilder.AddColumn(
+ name: "IsInternalCombination",
+ table: "EmployeePosts",
+ type: "bit",
+ nullable: false,
+ defaultValue: false);
+
+ migrationBuilder.AddColumn(
+ name: "PostId",
+ table: "EmployeePosts",
+ type: "uniqueidentifier",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
+
+ migrationBuilder.AddColumn(
+ name: "Rate",
+ table: "EmployeePosts",
+ type: "decimal(18,2)",
+ nullable: false,
+ defaultValue: 0m);
+
+ migrationBuilder.CreateTable(
+ name: "Posts",
+ columns: table => new
+ {
+ Id = table.Column(type: "uniqueidentifier", nullable: false),
+ PostName = table.Column(type: "nvarchar(450)", nullable: true),
+ Hours = table.Column(type: "int", nullable: true),
+ Order = table.Column(type: "int", nullable: false),
+ DateCreate = table.Column(type: "datetime2", nullable: false),
+ DateDelete = table.Column(type: "datetime2", nullable: true),
+ IsDeleted = table.Column(type: "bit", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Posts", x => x.Id);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LecturerPosts_LecturerId",
+ table: "LecturerPosts",
+ column: "LecturerId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LecturerPosts_PostId",
+ table: "LecturerPosts",
+ column: "PostId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EmployeePosts_EmployeeId",
+ table: "EmployeePosts",
+ column: "EmployeeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EmployeePosts_PostId",
+ table: "EmployeePosts",
+ column: "PostId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Posts_PostName",
+ table: "Posts",
+ column: "PostName",
+ unique: true,
+ filter: "[PostName] IS NOT NULL");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmployeePosts_Employees_EmployeeId",
+ table: "EmployeePosts",
+ column: "EmployeeId",
+ principalTable: "Employees",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmployeePosts_Posts_PostId",
+ table: "EmployeePosts",
+ column: "PostId",
+ principalTable: "Posts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_LecturerPosts_Lecturers_LecturerId",
+ table: "LecturerPosts",
+ column: "LecturerId",
+ principalTable: "Lecturers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_LecturerPosts_Posts_PostId",
+ table: "LecturerPosts",
+ column: "PostId",
+ principalTable: "Posts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_EmployeePosts_Employees_EmployeeId",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_EmployeePosts_Posts_PostId",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_LecturerPosts_Lecturers_LecturerId",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_LecturerPosts_Posts_PostId",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropTable(
+ name: "Posts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_LecturerPosts_LecturerId",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_LecturerPosts_PostId",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_EmployeePosts_EmployeeId",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_EmployeePosts_PostId",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "IsExternalCombination",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "IsInternalCombination",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "LecturerId",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "PostId",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "Rate",
+ table: "LecturerPosts");
+
+ migrationBuilder.DropColumn(
+ name: "EmployeeId",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "IsExternalCombination",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "IsInternalCombination",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "PostId",
+ table: "EmployeePosts");
+
+ migrationBuilder.DropColumn(
+ name: "Rate",
+ table: "EmployeePosts");
+
+ migrationBuilder.AddColumn(
+ name: "Hours",
+ table: "LecturerPosts",
+ type: "int",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.AddColumn(
+ name: "LecturerPostName",
+ table: "LecturerPosts",
+ type: "nvarchar(450)",
+ nullable: false,
+ defaultValue: "");
+
+ migrationBuilder.AddColumn(
+ name: "Order",
+ table: "LecturerPosts",
+ type: "int",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.AddColumn(
+ name: "EmployeePostName",
+ table: "EmployeePosts",
+ type: "nvarchar(450)",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "Order",
+ table: "EmployeePosts",
+ type: "int",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateTable(
+ name: "EmployeeEmployeePosts",
+ columns: table => new
+ {
+ Id = table.Column(type: "uniqueidentifier", nullable: false),
+ DateCreate = table.Column(type: "datetime2", nullable: false),
+ DateDelete = table.Column(type: "datetime2", nullable: true),
+ EmployeeId = table.Column(type: "uniqueidentifier", nullable: false),
+ EmployeePostId = table.Column(type: "uniqueidentifier", nullable: false),
+ IsDeleted = table.Column(type: "bit", nullable: false),
+ IsExternalCombination = table.Column(type: "bit", nullable: false),
+ IsInternalCombination = table.Column(type: "bit", nullable: false),
+ Rate = table.Column(type: "decimal(18,2)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_EmployeeEmployeePosts", x => x.Id);
+ table.ForeignKey(
+ name: "FK_EmployeeEmployeePosts_EmployeePosts_EmployeePostId",
+ column: x => x.EmployeePostId,
+ principalTable: "EmployeePosts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_EmployeeEmployeePosts_Employees_EmployeeId",
+ column: x => x.EmployeeId,
+ principalTable: "Employees",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "LecturerEmployeePosts",
+ columns: table => new
+ {
+ Id = table.Column(type: "uniqueidentifier", nullable: false),
+ DateCreate = table.Column(type: "datetime2", nullable: false),
+ DateDelete = table.Column(type: "datetime2", nullable: true),
+ EmployeePostId = table.Column(type: "uniqueidentifier", nullable: false),
+ IsDeleted = table.Column(type: "bit", nullable: false),
+ IsExternalCombination = table.Column(type: "bit", nullable: false),
+ IsInternalCombination = table.Column(type: "bit", nullable: false),
+ LecturerId = table.Column(type: "uniqueidentifier", nullable: false),
+ Rate = table.Column(type: "decimal(18,2)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_LecturerEmployeePosts", x => x.Id);
+ table.ForeignKey(
+ name: "FK_LecturerEmployeePosts_EmployeePosts_EmployeePostId",
+ column: x => x.EmployeePostId,
+ principalTable: "EmployeePosts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_LecturerEmployeePosts_Lecturers_LecturerId",
+ column: x => x.LecturerId,
+ principalTable: "Lecturers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Lecturers_LecturerPostId",
+ table: "Lecturers",
+ column: "LecturerPostId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LecturerPosts_LecturerPostName",
+ table: "LecturerPosts",
+ column: "LecturerPostName",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EmployeePosts_EmployeePostName",
+ table: "EmployeePosts",
+ column: "EmployeePostName",
+ unique: true,
+ filter: "[EmployeePostName] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EmployeeEmployeePosts_EmployeeId",
+ table: "EmployeeEmployeePosts",
+ column: "EmployeeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EmployeeEmployeePosts_EmployeePostId",
+ table: "EmployeeEmployeePosts",
+ column: "EmployeePostId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LecturerEmployeePosts_EmployeePostId",
+ table: "LecturerEmployeePosts",
+ column: "EmployeePostId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LecturerEmployeePosts_LecturerId",
+ table: "LecturerEmployeePosts",
+ column: "LecturerId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Lecturers_LecturerPosts_LecturerPostId",
+ table: "Lecturers",
+ column: "LecturerPostId",
+ principalTable: "LecturerPosts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+ }
+}
diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210405082110_AddFieldToLecturer.Designer.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210405082110_AddFieldToLecturer.Designer.cs
new file mode 100644
index 0000000..5ed3126
--- /dev/null
+++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210405082110_AddFieldToLecturer.Designer.cs
@@ -0,0 +1,813 @@
+//
+using System;
+using DatabaseCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace DatabaseCore.Migrations
+{
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20210405082110_AddFieldToLecturer")]
+ partial class AddFieldToLecturer
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("ProductVersion", "5.0.4")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Classroom", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Capacity")
+ .HasColumnType("int");
+
+ b.Property("ClassroomType")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("EmployeeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("HaveProjector")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Number")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Photo")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("SecurityCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Square")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Title")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EmployeeId");
+
+ b.HasIndex("Number")
+ .IsUnique()
+ .HasFilter("[Number] IS NOT NULL");
+
+ b.ToTable("Classrooms");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Discipline", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisciplineBlockId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisciplineBlueAsteriskName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisciplineName")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("DisciplineShortName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DisciplineBlockId");
+
+ b.HasIndex("DisciplineName")
+ .IsUnique();
+
+ b.ToTable("Disciplines");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.DisciplineBlock", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("DisciplineBlockBlueAsteriskName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisciplineBlockOrder")
+ .HasColumnType("int");
+
+ b.Property("DisciplineBlockUseForGrouping")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Title")
+ .IsUnique();
+
+ b.ToTable("DisciplineBlocks");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Address")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DateBirth")
+ .HasColumnType("datetime2");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("GroupElectricalSafety")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HomeNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MobileNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Patronymic")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Photo")
+ .HasColumnType("varbinary(max)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("FirstName", "LastName", "Patronymic")
+ .IsUnique()
+ .HasFilter("[FirstName] IS NOT NULL AND [LastName] IS NOT NULL AND [Patronymic] IS NOT NULL");
+
+ b.ToTable("Employees");
+ });
+
+ modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateDelete")
+ .HasColumnType("datetime2");
+
+ b.Property