┐(シ)┌ фиксы
This commit is contained in:
parent
cc6e66ef00
commit
22f02bc6bb
@ -8,6 +8,6 @@ namespace LawCompanyContracts.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 LawCompanyContracts.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; }
|
||||
}
|
||||
}
|
@ -7,6 +7,6 @@ namespace LawCompanyDataModels.Models
|
||||
string FIO { get; }
|
||||
string Phone { get; }
|
||||
string Email { get; }
|
||||
public int GuarantorId { get; }
|
||||
public int? GuarantorId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
public GuarantorViewModel? Insert(GuarantorBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var newGuarantor = Guarantor.Create(model);
|
||||
var newGuarantor = Guarantor.Create(context, model);
|
||||
if (newGuarantor == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -61,7 +61,7 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
public LawyerViewModel? Insert(LawyerBindingModel model)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
var newLawyer = Lawyer.Create(model);
|
||||
var newLawyer = Lawyer.Create(context, model);
|
||||
if (newLawyer == null)
|
||||
{
|
||||
return null;
|
||||
|
@ -15,7 +15,7 @@ namespace LawCompanyDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-H8060U3\SQLEXPRESS;Initial Catalog=LawCompanyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-6GNIALH9\SQLEXPRESS;Initial Catalog=LawCompanyDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -22,8 +22,7 @@ namespace LawCompanyDatabaseImplement.Models
|
||||
public virtual List<Lawyer> Lawyers { get; set; } = new();
|
||||
[ForeignKey("GuarantorId")]
|
||||
public virtual List<Consultation> Consultations { get; set; } = new();
|
||||
|
||||
public static Guarantor? Create(GuarantorBindingModel? model)
|
||||
public static Guarantor? Create(LawCompanyDatabase context, GuarantorBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
|
@ -1,12 +1,9 @@
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDataModels.Models;
|
||||
using LawCompanyDataModels.Models;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
@ -23,9 +20,9 @@ namespace LawCompanyDatabaseImplement.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(LawCompanyDatabase context, LawyerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -60,6 +57,7 @@ namespace LawCompanyDatabaseImplement.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