ляля поручмитель

This commit is contained in:
a.puchkina 2024-04-27 22:16:36 +04:00
parent 99b8127bf8
commit b7f880a90a
6 changed files with 15 additions and 11 deletions

View File

@ -11,12 +11,8 @@ namespace LawFirmDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
// optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-ON2V3BB\SQLEXPRESS;Initial Catalog=LawFirmDatabase;
//Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
// менять нада, пока скелетик
// optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-7A1PHA0\SQLEXPRESS;Initial Catalog=LawFirmDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=SchoolAgainStudyDataBase;Username=postgres;Password=186qazwsx");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Case> Cases { set; get; }

View File

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
<PackageReference Include="Npgsql" Version="8.0.2" />
</ItemGroup>
<ItemGroup>

View File

@ -19,6 +19,8 @@ namespace LawFirmDatabaseImplement.Models
public int GuarantorId { get; set; }
private Dictionary<int, ILawyerModel>? _consultationLawyers = null;
[ForeignKey("ConsultationId")]
public virtual List<ConsultationLawyer> Lawyers { get; set; } = new();
[NotMapped]
public Dictionary<int, ILawyerModel> ConsultationLawyers
{
@ -34,8 +36,6 @@ namespace LawFirmDatabaseImplement.Models
return _consultationLawyers;
}
}
[ForeignKey("ConsultationId")]
public virtual List<ConsultationLawyer> Lawyers { get; set; } = new();
public static Consultation? Create(LawFirmDatabase context, ConsultationBindingModel? model)
{
if (model == null)

View File

@ -2,6 +2,7 @@
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace LawFirmDatabaseImplement.Models
{
@ -14,6 +15,12 @@ namespace LawFirmDatabaseImplement.Models
public string Email { get; private set; } = string.Empty;
[Required]
public string Password { get; private set; } = string.Empty;
[ForeignKey("GuarantorId")]
public virtual List<Hearing> Hearings { get; set; } = new();
[ForeignKey("GuarantorId")]
public virtual List<Lawyer> Lawyers { get; set; } = new();
[ForeignKey("GuarantorId")]
public virtual List<Consultation> Consultations { get; set; } = new();
public static Guarantor? Create(GuarantorBindingModel? model)
{

View File

@ -17,6 +17,8 @@ namespace LawFirmDatabaseImplement.Models
public string Judge{ get; private set; } = string.Empty;
public int GuarantorId { get; set; }
private Dictionary<int, ILawyerModel>? _hearingLawyers = null;
[ForeignKey("HearingId")]
public virtual List<HearingLawyer> Lawyers { get; set; } = new();
[NotMapped]
public Dictionary<int, ILawyerModel> HearingLawyers
{
@ -32,8 +34,6 @@ namespace LawFirmDatabaseImplement.Models
return _hearingLawyers;
}
}
[ForeignKey("HearingId")]
public virtual List<HearingLawyer> Lawyers { get; set; } = new();
public static Hearing? Create(LawFirmDatabase context, HearingBindingModel? model)
{
if (model == null)

View File

@ -19,7 +19,7 @@ namespace LawFirmDatabaseImplement.Models
[ForeignKey("LawyerId")]
public virtual List<HearingLawyer> HearingLawyers { get; set; } = new();
[ForeignKey("LawyerId")]
public virtual List<ConsultationLawyer> LawyerConsultations { get; set; } = new();
public virtual List<ConsultationLawyer> ConsultationLawyers { get; set; } = new();
public int GuarantorId { get; set; }
public static Lawyer? Create(LawyerBindingModel? model)