пу пу пу
This commit is contained in:
parent
b7f880a90a
commit
d3343f2964
@ -135,7 +135,8 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
|||||||
Name = element.Name,
|
Name = element.Name,
|
||||||
DateCreate = element.DateCreate,
|
DateCreate = element.DateCreate,
|
||||||
Status = element.Status,
|
Status = element.Status,
|
||||||
CaseClients = element.CaseClients
|
CaseClients = element.CaseClients,
|
||||||
|
ExecutorId = element.ExecutorId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -141,8 +141,8 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
FIO = model.FIO,
|
FIO = model.FIO,
|
||||||
Phone = model.Phone,
|
Phone = model.Phone,
|
||||||
Email = model.Email
|
Email = model.Email,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
});
|
});
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,8 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
|||||||
Id = element.Id,
|
Id = element.Id,
|
||||||
VisitDate = element.VisitDate,
|
VisitDate = element.VisitDate,
|
||||||
HearingId = element.HearingId,
|
HearingId = element.HearingId,
|
||||||
VisitClients = element.VisitClients
|
VisitClients = element.VisitClients,
|
||||||
|
ExecutorId = element.ExecutorId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,5 +12,6 @@ namespace LawFirmContracts.BindingModels
|
|||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; }
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,6 @@ namespace LawFirmContracts.BindingModels
|
|||||||
public string FIO { get; set; } = string.Empty;
|
public string FIO { get; set; } = string.Empty;
|
||||||
public string Phone { get; set; } = string.Empty;
|
public string Phone { get; set; } = string.Empty;
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,6 @@ namespace LawFirmContracts.BindingModels
|
|||||||
public DateTime VisitDate { get; set; }
|
public DateTime VisitDate { get; set; }
|
||||||
public int HearingId { get; set; }
|
public int HearingId { get; set; }
|
||||||
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,6 @@
|
|||||||
public string? CaseType { get; set; }
|
public string? CaseType { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
|
public int? ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
public string? FIO { get; set; }
|
public string? FIO { get; set; }
|
||||||
public string? Phone { get; set; }
|
public string? Phone { get; set; }
|
||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
|
public int? ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,6 @@
|
|||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
public int? HearingId { get; set; }
|
public int? HearingId { get; set; }
|
||||||
|
public int? ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,6 @@ namespace LawFirmContracts.ViewModels
|
|||||||
[DisplayName("Дата выполнения")]
|
[DisplayName("Дата выполнения")]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
public Dictionary<int, IClientModel> CaseClients { get; set; } = new();
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,6 @@ namespace LawFirmContracts.ViewModels
|
|||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
[DisplayName("Телефон клиента")]
|
[DisplayName("Телефон клиента")]
|
||||||
public string Phone { get; set; } = string.Empty;
|
public string Phone { get; set; } = string.Empty;
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,6 @@ namespace LawFirmContracts.ViewModels
|
|||||||
public DateTime VisitDate { get; set; }
|
public DateTime VisitDate { get; set; }
|
||||||
public int HearingId { get; set; }
|
public int HearingId { get; set; }
|
||||||
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
public Dictionary<int, IClientModel> VisitClients { get; set; } = new();
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,23 +13,33 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Cases.Include(x => x.CaseClients)
|
return context.Cases.Include(x => x.CaseClients)
|
||||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<CaseViewModel> GetFilteredList(CaseSearchModel model)
|
public List<CaseViewModel> GetFilteredList(CaseSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.DateFrom.HasValue && !model.DateTo.HasValue)
|
if (!model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||||
|
&& !model.ExecutorId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
if (model.ExecutorId.HasValue)
|
||||||
|
{
|
||||||
|
using var context = new LawFirmDatabase();
|
||||||
|
return context.Cases
|
||||||
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
|
.Where(x => x.ExecutorId == model.ExecutorId).ToList()
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Cases.Include(x => x.CaseClients)
|
return context.Cases.Include(x => x.CaseClients)
|
||||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => x.GetViewModel).ToList()
|
.Select(x => x.GetViewModel).ToList()
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -46,14 +56,14 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
public CaseViewModel? GetElement(CaseSearchModel model)
|
public CaseViewModel? GetElement(CaseSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && string.IsNullOrEmpty(model.Name))
|
if (!model.Id.HasValue && !model.ExecutorId.HasValue && string.IsNullOrEmpty(model.Name))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Cases.Include(x => x.Clients).ThenInclude(x => x.Client)
|
return context.Cases.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
||||||
?.GetViewModel; //имя дела не должно повторяться, уникальное должно быть
|
?.GetViewModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
public CaseViewModel? Insert(CaseBindingModel model)
|
public CaseViewModel? Insert(CaseBindingModel model)
|
||||||
|
@ -15,10 +15,11 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
public List<ClientViewModel> GetFilteredList(ClientSearchModel
|
||||||
|
model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||||
&& string.IsNullOrEmpty(model.Phone))
|
&& string.IsNullOrEmpty(model.Phone) && !model.ExecutorId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
@ -30,6 +31,22 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
else if (model.ExecutorId.HasValue && model.Id.HasValue)
|
||||||
|
{
|
||||||
|
using var context = new LawFirmDatabase();
|
||||||
|
return context.Clients
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (model.ExecutorId.HasValue)
|
||||||
|
{
|
||||||
|
using var context = new LawFirmDatabase();
|
||||||
|
return context.Clients
|
||||||
|
.Where(x => x.ExecutorId == model.ExecutorId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
@ -42,7 +59,7 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue && string.IsNullOrEmpty(model.FIO)
|
||||||
&& string.IsNullOrEmpty(model.Phone))
|
&& string.IsNullOrEmpty(model.Phone) && !model.ExecutorId.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -50,7 +67,8 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
|
|
||||||
return context.Clients
|
return context.Clients
|
||||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email)
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email)
|
||||||
&& x.Email == model.Email) || (model.Id.HasValue && x.Id == model.Id))
|
&& x.Email == model.Email) || (model.Id.HasValue && x.Id == model.Id) || (model.ExecutorId.HasValue
|
||||||
|
&& x.ExecutorId == model.ExecutorId))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
public ClientViewModel? Insert(ClientBindingModel model)
|
public ClientViewModel? Insert(ClientBindingModel model)
|
||||||
|
@ -13,7 +13,7 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Visits
|
return context.Visits
|
||||||
.Include(x => x.Clients)
|
.Include(x => x.Clients)
|
||||||
.ThenInclude(x => x.Client)
|
.ThenInclude(x => x.Client)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -21,38 +21,30 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<VisitViewModel> GetFilteredList(VisitSearchModel model)
|
public List<VisitViewModel> GetFilteredList(VisitSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ExecutorId.HasValue
|
||||||
&& !model.VisitDate.HasValue && !model.HearingId.HasValue)
|
&& !model.VisitDate.HasValue && !model.HearingId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
if (model.ExecutorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Visits
|
return context.Visits
|
||||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.ExecutorId == model.ExecutorId && x.VisitDate >= model.DateFrom && x.VisitDate <= model.DateTo)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
else
|
else if (model.ExecutorId.HasValue)
|
||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Visits
|
return context.Visits
|
||||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.Where(x => x.VisitDate >= model.DateFrom && x.VisitDate <= model.DateTo)
|
.Where(x => x.ExecutorId == model.ExecutorId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||||
public List<VisitViewModel> GetFilteredDateList(VisitSearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
|
||||||
{
|
|
||||||
return new();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
|
||||||
{
|
{
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Visits
|
return context.Visits
|
||||||
@ -71,16 +63,44 @@ namespace LawFirmDatabaseImplement.Implements
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public List<VisitViewModel> GetFilteredDateList(VisitSearchModel model)
|
||||||
|
{
|
||||||
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ExecutorId.HasValue)
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||||
|
{
|
||||||
|
using var context = new LawFirmDatabase();
|
||||||
|
return context.Visits
|
||||||
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using var context = new LawFirmDatabase();
|
||||||
|
return context.Visits
|
||||||
|
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
|
.Where(x => x.VisitDate >= model.DateFrom && x.VisitDate <= model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
public VisitViewModel? GetElement(VisitSearchModel model)
|
public VisitViewModel? GetElement(VisitSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.VisitDate.HasValue && !model.HearingId.HasValue)
|
if (!model.Id.HasValue && !model.ExecutorId.HasValue
|
||||||
|
&& !model.VisitDate.HasValue && !model.HearingId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new LawFirmDatabase();
|
using var context = new LawFirmDatabase();
|
||||||
return context.Visits.Include(x => x.Clients).ThenInclude(x => x.Client)
|
return context.Visits.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||||
.FirstOrDefault(x => (model.HearingId.HasValue && x.Hearing == model.HearingId)
|
.FirstOrDefault(x => (model.HearingId.HasValue && x.HearingId == model.HearingId) || (model.Id.HasValue
|
||||||
|| (model.Id.HasValue && x.Id == model.Id))
|
&& x.Id == model.Id) || (model.ExecutorId.HasValue
|
||||||
|
&& x.ExecutorId == model.ExecutorId))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
public VisitViewModel? Insert(VisitBindingModel model)
|
public VisitViewModel? Insert(VisitBindingModel model)
|
||||||
|
@ -20,6 +20,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public CaseStatus Status { get; private set; }
|
public CaseStatus Status { get; private set; }
|
||||||
private Dictionary<int, IClientModel>? _caseClients = null;
|
private Dictionary<int, IClientModel>? _caseClients = null;
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, IClientModel> CaseClients
|
public Dictionary<int, IClientModel> CaseClients
|
||||||
@ -38,8 +39,6 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
[ForeignKey("CaseId")]
|
[ForeignKey("CaseId")]
|
||||||
public virtual List<CaseClient> Clients { get; set; } = new();
|
public virtual List<CaseClient> Clients { get; set; } = new();
|
||||||
[ForeignKey("CaseId")]
|
|
||||||
public virtual List<Hearing> Hearings { get; set; } = new();
|
|
||||||
public static Case Create(LawFirmDatabase context, CaseBindingModel model)
|
public static Case Create(LawFirmDatabase context, CaseBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -53,6 +52,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
DateCreate = model.DateCreate,
|
DateCreate = model.DateCreate,
|
||||||
DateImplement = model.DateImplement,
|
DateImplement = model.DateImplement,
|
||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
Clients = model.CaseClients.Select(x => new CaseClient
|
Clients = model.CaseClients.Select(x => new CaseClient
|
||||||
{
|
{
|
||||||
Client = context.Clients.First(y => y.Id == x.Key)
|
Client = context.Clients.First(y => y.Id == x.Key)
|
||||||
@ -72,7 +72,6 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
|
|
||||||
|
|
||||||
if (model.DateImplement.HasValue) DateImplement = model.DateImplement;
|
if (model.DateImplement.HasValue) DateImplement = model.DateImplement;
|
||||||
if (!model.CompanyId.HasValue) CompanyId = model.CompanyId;
|
|
||||||
}
|
}
|
||||||
public CaseViewModel GetViewModel => new()
|
public CaseViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
@ -81,6 +80,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
CaseType = CaseType,
|
CaseType = CaseType,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
DateImplement = DateImplement,
|
DateImplement = DateImplement,
|
||||||
|
ExecutorId = ExecutorId,
|
||||||
Status = Status,
|
Status = Status,
|
||||||
CaseClients = CaseClients,
|
CaseClients = CaseClients,
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
public virtual List<CaseClient> CaseClients { get; set; } = new();
|
public virtual List<CaseClient> CaseClients { get; set; } = new();
|
||||||
[ForeignKey("ClientId")]
|
[ForeignKey("ClientId")]
|
||||||
public virtual List<VisitClient> ClientVisits { get; set; } = new();
|
public virtual List<VisitClient> ClientVisits { get; set; } = new();
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
|
|
||||||
public static Client? Create(ClientBindingModel? model)
|
public static Client? Create(ClientBindingModel? model)
|
||||||
{
|
{
|
||||||
@ -32,6 +33,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
FIO = model.FIO,
|
FIO = model.FIO,
|
||||||
Email = model.Email,
|
Email = model.Email,
|
||||||
Phone = model.Phone,
|
Phone = model.Phone,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Client Create(ClientViewModel model)
|
public static Client Create(ClientViewModel model)
|
||||||
@ -42,6 +44,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
FIO = model.FIO,
|
FIO = model.FIO,
|
||||||
Email = model.Email,
|
Email = model.Email,
|
||||||
Phone = model.Phone,
|
Phone = model.Phone,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(ClientBindingModel? model)
|
public void Update(ClientBindingModel? model)
|
||||||
@ -60,6 +63,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
FIO = FIO,
|
FIO = FIO,
|
||||||
Email = Email,
|
Email = Email,
|
||||||
Phone = Phone,
|
Phone = Phone,
|
||||||
|
ExecutorId = ExecutorId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
public int HearingId { get; private set; }
|
public int HearingId { get; private set; }
|
||||||
public Hearing Hearing { get; set; } = null!;
|
public Hearing Hearing { get; set; } = null!;
|
||||||
//---
|
//---
|
||||||
public int? CompanyId { get; set; }
|
public int ExecutorId { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, IClientModel>? _visitClients = null;
|
private Dictionary<int, IClientModel>? _visitClients = null;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
@ -37,8 +37,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
[ForeignKey("VisitId")]
|
[ForeignKey("VisitId")]
|
||||||
public virtual List<VisitClient> Clients { get; set; } = new();
|
public virtual List<VisitClient> Clients { get; set; } = new();
|
||||||
public static Visit? Create(LawFirmDatabase context,
|
public static Visit? Create(LawFirmDatabase context, VisitBindingModel? model)
|
||||||
VisitBindingModel? model)
|
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -54,6 +53,7 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
VisitDate = model.VisitDate,
|
VisitDate = model.VisitDate,
|
||||||
HearingId = model.HearingId,
|
HearingId = model.HearingId,
|
||||||
|
ExecutorId = model.ExecutorId,
|
||||||
Hearing = context.Hearings.First(x => x.Id == model.HearingId),
|
Hearing = context.Hearings.First(x => x.Id == model.HearingId),
|
||||||
Clients = model.VisitClients.Select(x => new VisitClient
|
Clients = model.VisitClients.Select(x => new VisitClient
|
||||||
{
|
{
|
||||||
@ -78,7 +78,8 @@ namespace LawFirmDatabaseImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
VisitDate = VisitDate,
|
VisitDate = VisitDate,
|
||||||
HearingId = HearingId,
|
HearingId = HearingId,
|
||||||
VisitClients = VisitClients
|
VisitClients = VisitClients,
|
||||||
|
ExecutorId = ExecutorId,
|
||||||
};
|
};
|
||||||
public void UpdateClients(LawFirmDatabase context,
|
public void UpdateClients(LawFirmDatabase context,
|
||||||
VisitBindingModel model)
|
VisitBindingModel model)
|
||||||
|
Loading…
Reference in New Issue
Block a user