From 7df34a98943b13d88595368e93594471977ad6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B0=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A4=D0=B5=D0=B4?= =?UTF-8?q?=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sun, 28 Apr 2024 01:40:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BA=D0=B0=D0=BA=20=D1=82=D0=BE=20=D0=BE=D0=B4?= =?UTF-8?q?=D0=BD=D0=BE=D0=BD=D0=BE=D0=B3=D0=BE=D0=BC=D1=83=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=D1=81=D0=BE=20=D0=B8=20=D0=BF=D0=BE=D1=88=D0=BB?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=BE=D0=B5=D1=85=D0=B0=D0=BB=D0=BE=20(=D0=BC?= =?UTF-8?q?=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D1=8F!)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LawFim/LawFim.sln | 10 +- .../LawFirmDatabase.cs | 4 +- .../LawFirmDatabaseImplement.csproj | 8 +- .../20240427212157_InitialCreate.Designer.cs | 545 ++++++++++++++++++ .../20240427212157_InitialCreate.cs | 413 +++++++++++++ .../LawFirmDatabaseModelSnapshot.cs | 542 +++++++++++++++++ .../Controllers/WeatherForecastController.cs | 33 ++ LawFim/LawFirmRestApi/LawFirmRestApi.csproj | 23 + LawFim/LawFirmRestApi/Program.cs | 25 + .../Properties/launchSettings.json | 31 + LawFim/LawFirmRestApi/WeatherForecast.cs | 13 + .../appsettings.Development.json | 8 + LawFim/LawFirmRestApi/appsettings.json | 9 + 13 files changed, 1658 insertions(+), 6 deletions(-) create mode 100644 LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.Designer.cs create mode 100644 LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.cs create mode 100644 LawFim/LawFirmDatabaseImplement/Migrations/LawFirmDatabaseModelSnapshot.cs create mode 100644 LawFim/LawFirmRestApi/Controllers/WeatherForecastController.cs create mode 100644 LawFim/LawFirmRestApi/LawFirmRestApi.csproj create mode 100644 LawFim/LawFirmRestApi/Program.cs create mode 100644 LawFim/LawFirmRestApi/Properties/launchSettings.json create mode 100644 LawFim/LawFirmRestApi/WeatherForecast.cs create mode 100644 LawFim/LawFirmRestApi/appsettings.Development.json create mode 100644 LawFim/LawFirmRestApi/appsettings.json diff --git a/LawFim/LawFim.sln b/LawFim/LawFim.sln index 4fbe3ff..7282c98 100644 --- a/LawFim/LawFim.sln +++ b/LawFim/LawFim.sln @@ -7,9 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFimDataModels", "LawFimD EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmContracts", "LawFirmContracts\LawFirmContracts.csproj", "{61348245-9074-4C17-9698-7603F41E1D94}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{F44ACB2B-758D-409C-93AA-631FF5C629D4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{F44ACB2B-758D-409C-93AA-631FF5C629D4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmDatabaseImplement", "LawFirmDatabaseImplement\LawFirmDatabaseImplement.csproj", "{B208BCE7-EBB4-4D52-BE79-F4E50940FA73}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmDatabaseImplement", "LawFirmDatabaseImplement\LawFirmDatabaseImplement.csproj", "{B208BCE7-EBB4-4D52-BE79-F4E50940FA73}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmRestApi", "LawFirmRestApi\LawFirmRestApi.csproj", "{7AB047DE-CA1A-4F17-93A6-F6DC13E52826}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -33,6 +35,10 @@ Global {B208BCE7-EBB4-4D52-BE79-F4E50940FA73}.Debug|Any CPU.Build.0 = Debug|Any CPU {B208BCE7-EBB4-4D52-BE79-F4E50940FA73}.Release|Any CPU.ActiveCfg = Release|Any CPU {B208BCE7-EBB4-4D52-BE79-F4E50940FA73}.Release|Any CPU.Build.0 = Release|Any CPU + {7AB047DE-CA1A-4F17-93A6-F6DC13E52826}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AB047DE-CA1A-4F17-93A6-F6DC13E52826}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AB047DE-CA1A-4F17-93A6-F6DC13E52826}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AB047DE-CA1A-4F17-93A6-F6DC13E52826}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs b/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs index 3e04b83..4d12370 100644 --- a/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs +++ b/LawFim/LawFirmDatabaseImplement/LawFirmDatabase.cs @@ -11,9 +11,9 @@ namespace LawFirmDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - //optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-7A1PHA0\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=ZIRAEL\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); - optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + //optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/LawFim/LawFirmDatabaseImplement/LawFirmDatabaseImplement.csproj b/LawFim/LawFirmDatabaseImplement/LawFirmDatabaseImplement.csproj index cd8e8fc..de2e5b5 100644 --- a/LawFim/LawFirmDatabaseImplement/LawFirmDatabaseImplement.csproj +++ b/LawFim/LawFirmDatabaseImplement/LawFirmDatabaseImplement.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -7,8 +7,12 @@ - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.Designer.cs b/LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.Designer.cs new file mode 100644 index 0000000..da2bed6 --- /dev/null +++ b/LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.Designer.cs @@ -0,0 +1,545 @@ +// +using System; +using LawFirmDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace LawFirmDatabaseImplement.Migrations +{ + [DbContext(typeof(LawFirmDatabase))] + [Migration("20240427212157_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.17") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CaseType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("ExecutorId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ExecutorId"); + + b.ToTable("Cases"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CaseId") + .HasColumnType("int"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaseId"); + + b.HasIndex("ClientId"); + + b.ToTable("CaseClients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExecutorId") + .HasColumnType("int"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ExecutorId"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CaseId") + .HasColumnType("int"); + + b.Property("ConsultationDate") + .HasColumnType("datetime2"); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("GuarantorId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaseId"); + + b.HasIndex("GuarantorId"); + + b.ToTable("Consultations"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConsultationId") + .HasColumnType("int"); + + b.Property("LawyerId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ConsultationId"); + + b.HasIndex("LawyerId"); + + b.ToTable("ConsultationLawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Executor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Executors"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Guarantor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Guarantors"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GuarantorId") + .HasColumnType("int"); + + b.Property("HearingDate") + .HasColumnType("datetime2"); + + b.Property("Judge") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GuarantorId"); + + b.ToTable("Hearings"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("HearingId") + .HasColumnType("int"); + + b.Property("LawyerId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("HearingId"); + + b.HasIndex("LawyerId"); + + b.ToTable("HearingLawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GuarantorId") + .HasColumnType("int"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GuarantorId"); + + b.ToTable("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ExecutorId") + .HasColumnType("int"); + + b.Property("HearingId") + .HasColumnType("int"); + + b.Property("VisitDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ExecutorId"); + + b.HasIndex("HearingId"); + + b.ToTable("Visits"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("VisitId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("VisitId"); + + b.ToTable("VisitClients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Executor", null) + .WithMany("Cases") + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Case", "Case") + .WithMany("Clients") + .HasForeignKey("CaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Client", "Client") + .WithMany("CaseClients") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + + b.Navigation("Client"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Executor", null) + .WithMany("Clients") + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Case", "Case") + .WithMany() + .HasForeignKey("CaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null) + .WithMany("Consultations") + .HasForeignKey("GuarantorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Consultation", "Consultation") + .WithMany("Lawyers") + .HasForeignKey("ConsultationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Lawyer", "Lawyer") + .WithMany("ConsultationLawyers") + .HasForeignKey("LawyerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Consultation"); + + b.Navigation("Lawyer"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null) + .WithMany("Hearings") + .HasForeignKey("GuarantorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Hearing", "Hearing") + .WithMany("Lawyers") + .HasForeignKey("HearingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Lawyer", "Lawyer") + .WithMany("HearingLawyers") + .HasForeignKey("LawyerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hearing"); + + b.Navigation("Lawyer"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null) + .WithMany("Lawyers") + .HasForeignKey("GuarantorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Executor", null) + .WithMany("Visits") + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Hearing", "Hearing") + .WithMany() + .HasForeignKey("HearingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hearing"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Client", "Client") + .WithMany("ClientVisits") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Visit", "Visit") + .WithMany("Clients") + .HasForeignKey("VisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Visit"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b => + { + b.Navigation("Clients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b => + { + b.Navigation("CaseClients"); + + b.Navigation("ClientVisits"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b => + { + b.Navigation("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Executor", b => + { + b.Navigation("Cases"); + + b.Navigation("Clients"); + + b.Navigation("Visits"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Guarantor", b => + { + b.Navigation("Consultations"); + + b.Navigation("Hearings"); + + b.Navigation("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b => + { + b.Navigation("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b => + { + b.Navigation("ConsultationLawyers"); + + b.Navigation("HearingLawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b => + { + b.Navigation("Clients"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.cs b/LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.cs new file mode 100644 index 0000000..351e860 --- /dev/null +++ b/LawFim/LawFirmDatabaseImplement/Migrations/20240427212157_InitialCreate.cs @@ -0,0 +1,413 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LawFirmDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Executors", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Executors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Guarantors", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Guarantors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Cases", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + CaseType = table.Column(type: "nvarchar(max)", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true), + Status = table.Column(type: "int", nullable: false), + ExecutorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Cases", x => x.Id); + table.ForeignKey( + name: "FK_Cases_Executors_ExecutorId", + column: x => x.ExecutorId, + principalTable: "Executors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Phone = table.Column(type: "nvarchar(max)", nullable: false), + ExecutorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + table.ForeignKey( + name: "FK_Clients_Executors_ExecutorId", + column: x => x.ExecutorId, + principalTable: "Executors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Hearings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + HearingDate = table.Column(type: "datetime2", nullable: false), + Judge = table.Column(type: "nvarchar(max)", nullable: false), + GuarantorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Hearings", x => x.Id); + table.ForeignKey( + name: "FK_Hearings_Guarantors_GuarantorId", + column: x => x.GuarantorId, + principalTable: "Guarantors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Lawyers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Phone = table.Column(type: "nvarchar(max)", nullable: false), + GuarantorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Lawyers", x => x.Id); + table.ForeignKey( + name: "FK_Lawyers_Guarantors_GuarantorId", + column: x => x.GuarantorId, + principalTable: "Guarantors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Consultations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Cost = table.Column(type: "float", nullable: false), + ConsultationDate = table.Column(type: "datetime2", nullable: false), + CaseId = table.Column(type: "int", nullable: false), + GuarantorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Consultations", x => x.Id); + table.ForeignKey( + name: "FK_Consultations_Cases_CaseId", + column: x => x.CaseId, + principalTable: "Cases", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Consultations_Guarantors_GuarantorId", + column: x => x.GuarantorId, + principalTable: "Guarantors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CaseClients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CaseId = table.Column(type: "int", nullable: false), + ClientId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CaseClients", x => x.Id); + table.ForeignKey( + name: "FK_CaseClients_Cases_CaseId", + column: x => x.CaseId, + principalTable: "Cases", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CaseClients_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + }); + + migrationBuilder.CreateTable( + name: "Visits", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + VisitDate = table.Column(type: "datetime2", nullable: false), + HearingId = table.Column(type: "int", nullable: false), + ExecutorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Visits", x => x.Id); + table.ForeignKey( + name: "FK_Visits_Executors_ExecutorId", + column: x => x.ExecutorId, + principalTable: "Executors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Visits_Hearings_HearingId", + column: x => x.HearingId, + principalTable: "Hearings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "HearingLawyers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + HearingId = table.Column(type: "int", nullable: false), + LawyerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_HearingLawyers", x => x.Id); + table.ForeignKey( + name: "FK_HearingLawyers_Hearings_HearingId", + column: x => x.HearingId, + principalTable: "Hearings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_HearingLawyers_Lawyers_LawyerId", + column: x => x.LawyerId, + principalTable: "Lawyers", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + }); + + migrationBuilder.CreateTable( + name: "ConsultationLawyers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ConsultationId = table.Column(type: "int", nullable: false), + LawyerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ConsultationLawyers", x => x.Id); + table.ForeignKey( + name: "FK_ConsultationLawyers_Consultations_ConsultationId", + column: x => x.ConsultationId, + principalTable: "Consultations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ConsultationLawyers_Lawyers_LawyerId", + column: x => x.LawyerId, + principalTable: "Lawyers", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + }); + + migrationBuilder.CreateTable( + name: "VisitClients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientId = table.Column(type: "int", nullable: false), + VisitId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VisitClients", x => x.Id); + table.ForeignKey( + name: "FK_VisitClients_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_VisitClients_Visits_VisitId", + column: x => x.VisitId, + principalTable: "Visits", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + }); + + migrationBuilder.CreateIndex( + name: "IX_CaseClients_CaseId", + table: "CaseClients", + column: "CaseId"); + + migrationBuilder.CreateIndex( + name: "IX_CaseClients_ClientId", + table: "CaseClients", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_Cases_ExecutorId", + table: "Cases", + column: "ExecutorId"); + + migrationBuilder.CreateIndex( + name: "IX_Clients_ExecutorId", + table: "Clients", + column: "ExecutorId"); + + migrationBuilder.CreateIndex( + name: "IX_ConsultationLawyers_ConsultationId", + table: "ConsultationLawyers", + column: "ConsultationId"); + + migrationBuilder.CreateIndex( + name: "IX_ConsultationLawyers_LawyerId", + table: "ConsultationLawyers", + column: "LawyerId"); + + migrationBuilder.CreateIndex( + name: "IX_Consultations_CaseId", + table: "Consultations", + column: "CaseId"); + + migrationBuilder.CreateIndex( + name: "IX_Consultations_GuarantorId", + table: "Consultations", + column: "GuarantorId"); + + migrationBuilder.CreateIndex( + name: "IX_HearingLawyers_HearingId", + table: "HearingLawyers", + column: "HearingId"); + + migrationBuilder.CreateIndex( + name: "IX_HearingLawyers_LawyerId", + table: "HearingLawyers", + column: "LawyerId"); + + migrationBuilder.CreateIndex( + name: "IX_Hearings_GuarantorId", + table: "Hearings", + column: "GuarantorId"); + + migrationBuilder.CreateIndex( + name: "IX_Lawyers_GuarantorId", + table: "Lawyers", + column: "GuarantorId"); + + migrationBuilder.CreateIndex( + name: "IX_VisitClients_ClientId", + table: "VisitClients", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_VisitClients_VisitId", + table: "VisitClients", + column: "VisitId"); + + migrationBuilder.CreateIndex( + name: "IX_Visits_ExecutorId", + table: "Visits", + column: "ExecutorId"); + + migrationBuilder.CreateIndex( + name: "IX_Visits_HearingId", + table: "Visits", + column: "HearingId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CaseClients"); + + migrationBuilder.DropTable( + name: "ConsultationLawyers"); + + migrationBuilder.DropTable( + name: "HearingLawyers"); + + migrationBuilder.DropTable( + name: "VisitClients"); + + migrationBuilder.DropTable( + name: "Consultations"); + + migrationBuilder.DropTable( + name: "Lawyers"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropTable( + name: "Visits"); + + migrationBuilder.DropTable( + name: "Cases"); + + migrationBuilder.DropTable( + name: "Hearings"); + + migrationBuilder.DropTable( + name: "Executors"); + + migrationBuilder.DropTable( + name: "Guarantors"); + } + } +} diff --git a/LawFim/LawFirmDatabaseImplement/Migrations/LawFirmDatabaseModelSnapshot.cs b/LawFim/LawFirmDatabaseImplement/Migrations/LawFirmDatabaseModelSnapshot.cs new file mode 100644 index 0000000..5c8d4c6 --- /dev/null +++ b/LawFim/LawFirmDatabaseImplement/Migrations/LawFirmDatabaseModelSnapshot.cs @@ -0,0 +1,542 @@ +// +using System; +using LawFirmDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace LawFirmDatabaseImplement.Migrations +{ + [DbContext(typeof(LawFirmDatabase))] + partial class LawFirmDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.17") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CaseType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("ExecutorId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ExecutorId"); + + b.ToTable("Cases"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CaseId") + .HasColumnType("int"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaseId"); + + b.HasIndex("ClientId"); + + b.ToTable("CaseClients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExecutorId") + .HasColumnType("int"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ExecutorId"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CaseId") + .HasColumnType("int"); + + b.Property("ConsultationDate") + .HasColumnType("datetime2"); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("GuarantorId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaseId"); + + b.HasIndex("GuarantorId"); + + b.ToTable("Consultations"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConsultationId") + .HasColumnType("int"); + + b.Property("LawyerId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ConsultationId"); + + b.HasIndex("LawyerId"); + + b.ToTable("ConsultationLawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Executor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Executors"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Guarantor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Guarantors"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GuarantorId") + .HasColumnType("int"); + + b.Property("HearingDate") + .HasColumnType("datetime2"); + + b.Property("Judge") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GuarantorId"); + + b.ToTable("Hearings"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("HearingId") + .HasColumnType("int"); + + b.Property("LawyerId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("HearingId"); + + b.HasIndex("LawyerId"); + + b.ToTable("HearingLawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GuarantorId") + .HasColumnType("int"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GuarantorId"); + + b.ToTable("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ExecutorId") + .HasColumnType("int"); + + b.Property("HearingId") + .HasColumnType("int"); + + b.Property("VisitDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ExecutorId"); + + b.HasIndex("HearingId"); + + b.ToTable("Visits"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("VisitId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("VisitId"); + + b.ToTable("VisitClients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Executor", null) + .WithMany("Cases") + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Case", "Case") + .WithMany("Clients") + .HasForeignKey("CaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Client", "Client") + .WithMany("CaseClients") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + + b.Navigation("Client"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Executor", null) + .WithMany("Clients") + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Case", "Case") + .WithMany() + .HasForeignKey("CaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null) + .WithMany("Consultations") + .HasForeignKey("GuarantorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Consultation", "Consultation") + .WithMany("Lawyers") + .HasForeignKey("ConsultationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Lawyer", "Lawyer") + .WithMany("ConsultationLawyers") + .HasForeignKey("LawyerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Consultation"); + + b.Navigation("Lawyer"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null) + .WithMany("Hearings") + .HasForeignKey("GuarantorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Hearing", "Hearing") + .WithMany("Lawyers") + .HasForeignKey("HearingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Lawyer", "Lawyer") + .WithMany("HearingLawyers") + .HasForeignKey("LawyerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hearing"); + + b.Navigation("Lawyer"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null) + .WithMany("Lawyers") + .HasForeignKey("GuarantorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Executor", null) + .WithMany("Visits") + .HasForeignKey("ExecutorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Hearing", "Hearing") + .WithMany() + .HasForeignKey("HearingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hearing"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b => + { + b.HasOne("LawFirmDatabaseImplement.Models.Client", "Client") + .WithMany("ClientVisits") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LawFirmDatabaseImplement.Models.Visit", "Visit") + .WithMany("Clients") + .HasForeignKey("VisitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Visit"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b => + { + b.Navigation("Clients"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b => + { + b.Navigation("CaseClients"); + + b.Navigation("ClientVisits"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b => + { + b.Navigation("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Executor", b => + { + b.Navigation("Cases"); + + b.Navigation("Clients"); + + b.Navigation("Visits"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Guarantor", b => + { + b.Navigation("Consultations"); + + b.Navigation("Hearings"); + + b.Navigation("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b => + { + b.Navigation("Lawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b => + { + b.Navigation("ConsultationLawyers"); + + b.Navigation("HearingLawyers"); + }); + + modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b => + { + b.Navigation("Clients"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/LawFim/LawFirmRestApi/Controllers/WeatherForecastController.cs b/LawFim/LawFirmRestApi/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..115c653 --- /dev/null +++ b/LawFim/LawFirmRestApi/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace LawFirmRestApi.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} \ No newline at end of file diff --git a/LawFim/LawFirmRestApi/LawFirmRestApi.csproj b/LawFim/LawFirmRestApi/LawFirmRestApi.csproj new file mode 100644 index 0000000..91d5677 --- /dev/null +++ b/LawFim/LawFirmRestApi/LawFirmRestApi.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + diff --git a/LawFim/LawFirmRestApi/Program.cs b/LawFim/LawFirmRestApi/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/LawFim/LawFirmRestApi/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/LawFim/LawFirmRestApi/Properties/launchSettings.json b/LawFim/LawFirmRestApi/Properties/launchSettings.json new file mode 100644 index 0000000..f1b1777 --- /dev/null +++ b/LawFim/LawFirmRestApi/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:49016", + "sslPort": 44354 + } + }, + "profiles": { + "LawFirmRestApi": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7033;http://localhost:5223", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/LawFim/LawFirmRestApi/WeatherForecast.cs b/LawFim/LawFirmRestApi/WeatherForecast.cs new file mode 100644 index 0000000..b9f6e7c --- /dev/null +++ b/LawFim/LawFirmRestApi/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace LawFirmRestApi +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} \ No newline at end of file diff --git a/LawFim/LawFirmRestApi/appsettings.Development.json b/LawFim/LawFirmRestApi/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/LawFim/LawFirmRestApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/LawFim/LawFirmRestApi/appsettings.json b/LawFim/LawFirmRestApi/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/LawFim/LawFirmRestApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}