сваггер блин :( я спать
This commit is contained in:
parent
515cb18e76
commit
cd7eac4f32
@ -5,6 +5,6 @@
|
||||
string FIO { get; }
|
||||
string Phone { get; }
|
||||
string Email { get; }
|
||||
public int GuarantorId { get; }
|
||||
public int? GuarantorId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
private readonly ILogger _logger;
|
||||
private readonly IGuarantorStorage _guarantorStorage;
|
||||
|
||||
public GuarantorLogic(ILogger<IGuarantorLogic>logger, IGuarantorStorage guarantorStorage)
|
||||
public GuarantorLogic(ILogger<GuarantorLogic>logger, IGuarantorStorage guarantorStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_guarantorStorage = guarantorStorage;
|
||||
|
@ -8,6 +8,6 @@ namespace LawFirmContracts.BindingModels
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public int GuarantorId { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ namespace LawFirmContracts.ViewModels
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
[DisplayName("E-mail юриста")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public int GuarantorId { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public GuarantorViewModel? Insert(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
var newGuarantor = Guarantor.Create(model);
|
||||
var newGuarantor = Guarantor.Create(context, model);
|
||||
if (newGuarantor == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -61,7 +61,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public LawyerViewModel? Insert(LawyerBindingModel model)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
var newLawyer = Lawyer.Create(model);
|
||||
var newLawyer = Lawyer.Create(context, model);
|
||||
if (newLawyer == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -11,9 +11,9 @@ namespace LawFirmDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=ZIRAEL\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);
|
||||
}
|
||||
|
543
LawFim/LawFirmDatabaseImplement/Migrations/20240430213253_Migration1.Designer.cs
generated
Normal file
543
LawFim/LawFirmDatabaseImplement/Migrations/20240430213253_Migration1.Designer.cs
generated
Normal file
@ -0,0 +1,543 @@
|
||||
// <auto-generated />
|
||||
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("20240430213253_Migration1")]
|
||||
partial class Migration1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CaseType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("CaseClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("ConsultationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Consultations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ConsultationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConsultationId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("ConsultationLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Executor", 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>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Executors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Guarantor", 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>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Guarantors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("HearingDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Judge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", 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<int?>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ExecutorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HearingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("VisitDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.ToTable("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("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");
|
||||
});
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawFirmDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Migration1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||
table: "Lawyers");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "GuarantorId",
|
||||
table: "Lawyers",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||
table: "Lawyers",
|
||||
column: "GuarantorId",
|
||||
principalTable: "Guarantors",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||
table: "Lawyers");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "GuarantorId",
|
||||
table: "Lawyers",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Lawyers_Guarantors_GuarantorId",
|
||||
table: "Lawyers",
|
||||
column: "GuarantorId",
|
||||
principalTable: "Guarantors",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Cases", (string)null);
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.CaseClient", b =>
|
||||
@ -77,7 +77,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("CaseClients", (string)null);
|
||||
b.ToTable("CaseClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Client", b =>
|
||||
@ -107,7 +107,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("ExecutorId");
|
||||
|
||||
b.ToTable("Clients", (string)null);
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Consultation", b =>
|
||||
@ -136,7 +136,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Consultations", (string)null);
|
||||
b.ToTable("Consultations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.ConsultationLawyer", b =>
|
||||
@ -159,7 +159,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("ConsultationLawyers", (string)null);
|
||||
b.ToTable("ConsultationLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Executor", b =>
|
||||
@ -184,7 +184,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Executors", (string)null);
|
||||
b.ToTable("Executors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Guarantor", b =>
|
||||
@ -209,7 +209,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Guarantors", (string)null);
|
||||
b.ToTable("Guarantors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Hearing", b =>
|
||||
@ -234,7 +234,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Hearings", (string)null);
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.HearingLawyer", b =>
|
||||
@ -257,7 +257,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("HearingLawyers", (string)null);
|
||||
b.ToTable("HearingLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Lawyer", b =>
|
||||
@ -276,7 +276,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("GuarantorId")
|
||||
b.Property<int?>("GuarantorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
@ -287,7 +287,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("GuarantorId");
|
||||
|
||||
b.ToTable("Lawyers", (string)null);
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b =>
|
||||
@ -313,7 +313,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("HearingId");
|
||||
|
||||
b.ToTable("Visits", (string)null);
|
||||
b.ToTable("Visits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.VisitClient", b =>
|
||||
@ -336,7 +336,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("VisitId");
|
||||
|
||||
b.ToTable("VisitClients", (string)null);
|
||||
b.ToTable("VisitClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Case", b =>
|
||||
@ -444,9 +444,7 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Guarantor", null)
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("GuarantorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("GuarantorId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Visit", b =>
|
||||
|
@ -22,7 +22,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
[ForeignKey("GuarantorId")]
|
||||
public virtual List<Consultation> Consultations { get; set; } = new();
|
||||
|
||||
public static Guarantor? Create(GuarantorBindingModel? model)
|
||||
public static Guarantor? Create(LawFirmDatabase context, GuarantorBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
|
||||
namespace LawFirmDatabaseImplement.Models
|
||||
@ -20,9 +21,9 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public virtual List<HearingLawyer> HearingLawyers { get; set; } = new();
|
||||
[ForeignKey("LawyerId")]
|
||||
public virtual List<ConsultationLawyer> ConsultationLawyers { get; set; } = new();
|
||||
public int GuarantorId { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
|
||||
public static Lawyer? Create(LawyerBindingModel? model)
|
||||
public static Lawyer? Create(LawFirmDatabase context, LawyerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -57,6 +58,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
FIO = model.FIO;
|
||||
Email = model.Email;
|
||||
Phone = model.Phone;
|
||||
if (!model.GuarantorId.HasValue) GuarantorId = model.GuarantorId;
|
||||
}
|
||||
public LawyerViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ builder.Services.AddTransient<ILawyerStorage, LawyerStorage>();
|
||||
builder.Services.AddTransient<IHearingStorage, HearingStorage>();
|
||||
|
||||
builder.Services.AddTransient<IExecutorStorage, ExecutorStorage>();
|
||||
//builder.Services.AddTransient<IGuarantorStorage, GuarantorStorage>();
|
||||
builder.Services.AddTransient<IGuarantorStorage, GuarantorStorage>();
|
||||
|
||||
|
||||
builder.Services.AddTransient<ICaseLogic, CaseLogic>();
|
||||
@ -32,7 +32,7 @@ builder.Services.AddTransient<IHearingLogic, HearingLogic>();
|
||||
builder.Services.AddTransient<ILawyerLogic, LawyerLogic>();
|
||||
|
||||
builder.Services.AddTransient<IExecutorLogic, ExecutorLogic>();
|
||||
//builder.Services.AddTransient<IGuarantorLogic, GuarantorLogic>();
|
||||
builder.Services.AddTransient<IGuarantorLogic, GuarantorLogic>();
|
||||
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
Loading…
Reference in New Issue
Block a user