правки
This commit is contained in:
parent
9c4ea547f1
commit
65decf8f3f
@ -1,9 +1,9 @@
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyDataModels.Models;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.BusinessLogicContracts;
|
||||
using LawCompanyContracts.SearchModels;
|
||||
using LawCompanyContracts.StoragesContracts;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace LawCompanyBusinessLogic.BusinessLogics
|
||||
@ -95,7 +95,10 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element.HearingLawyers.ContainsKey(lawyer.Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
element.HearingLawyers[lawyer.Id] = lawyer;
|
||||
|
||||
_hearingStorage.Update(new()
|
||||
@ -119,11 +122,15 @@ namespace LawCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Judge))
|
||||
{
|
||||
throw new ArgumentNullException("Не указан суд",
|
||||
nameof(model.Judge));
|
||||
}
|
||||
if (string.IsNullOrEmpty((model.HearingDate).ToString()))
|
||||
{
|
||||
throw new ArgumentNullException("Не поставлено время", nameof(model.HearingDate));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Hearing. HearingDate:{HearingDate}. Id: {Id} ", model.HearingDate, model.Id);
|
||||
var element = _hearingStorage.GetElement(new HearingSearchModel
|
||||
{
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ namespace LawCompanyContracts.ViewModels
|
||||
public DateTime HearingDate { get; set; }
|
||||
[DisplayName("Суд")]
|
||||
public string Judge { get; set; } = string.Empty;
|
||||
[DisplayName("Имя поручителя")]
|
||||
public string GuarantorName { get; set; } = string.Empty;
|
||||
public int GuarantorId { get; set; }
|
||||
public Dictionary<int, ILawyerModel> HearingLawyers { get; set; } = new();
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -11,6 +11,6 @@ namespace LawCompanyDataModels.Models
|
||||
string FIO { get; }
|
||||
string Phone { get; }
|
||||
string Email { get; }
|
||||
public int GuarantorId { get; }
|
||||
public int? GuarantorId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyDataModels.Models;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Models;
|
||||
using LawCompanyDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using LawFirmDatabaseImplement.Models;
|
||||
|
||||
namespace LawFirmDatabaseImplement.Models
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
public class Guarantor : IGuarantorModel
|
||||
{
|
||||
@ -23,7 +23,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
[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,12 @@
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyDataModels.Models;
|
||||
using LawCompanyContracts.BindingModels;
|
||||
using LawCompanyContracts.ViewModels;
|
||||
using LawCompanyDatabaseImplement.Models;
|
||||
using LawCompanyDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
|
||||
namespace LawFirmDatabaseImplement.Models
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
public class Lawyer : ILawyerModel
|
||||
{
|
||||
@ -21,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(LawCompanyDatabase context, LawyerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -58,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()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user