поручитель in progress
This commit is contained in:
parent
f0c9e40194
commit
4c59888ee6
@ -10,8 +10,6 @@ namespace LawCompanyContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public DateTime? HearingDate { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? GuarantorId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -21,17 +21,17 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
}
|
||||
public List<ConsultationViewModel> GetFilteredList(ConsultationSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.Cost.HasValue && !model.ConsultationDate.HasValue
|
||||
&& !model.CaseId.HasValue && !model.GuarantorId.HasValue)
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||
if (!model.GuarantorId.HasValue)
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Consultations
|
||||
.Include(x => x.Lawyers).ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.GuarantorId == model.GuarantorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -39,23 +39,25 @@ namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Consultations
|
||||
.Include(x => x.Lawyers).ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.ConsultationDate >= model.DateFrom && x.ConsultationDate <= model.DateTo)
|
||||
.Include(x => x.Lawyers)
|
||||
.ThenInclude(x => x.Lawyer)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public ConsultationViewModel? GetElement(ConsultationSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.ConsultationDate.HasValue && !model.CaseId.HasValue)
|
||||
if (!model.Id.HasValue && !model.GuarantorId.HasValue)
|
||||
{
|
||||
return new();
|
||||
return null;
|
||||
}
|
||||
using var context = new LawCompanyDatabase();
|
||||
return context.Consultations.Include(x => x.Lawyers).ThenInclude(x => x.Lawyer)
|
||||
.FirstOrDefault(x => (model.CaseId.HasValue && x.Case == model.CaseId)
|
||||
|| (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
return context.Consultations.
|
||||
Include(x => x.Lawyers).
|
||||
ThenInclude(x => x.Lawyer)
|
||||
.FirstOrDefault(x => (model.GuarantorId.HasValue && x.GuarantorId == model.GuarantorId)
|
||||
|| (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
public ConsultationViewModel? Insert(ConsultationBindingModel model)
|
||||
{
|
||||
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
internal class GuarantorStorage
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
internal class HearingStorage
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Implements
|
||||
{
|
||||
internal class LawyerStorage
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
internal class Consultation
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
internal class ConsultationLawyer
|
||||
{
|
||||
}
|
||||
}
|
12
LawCompany/LawCompanyDatabaseImplement/Models/Guarantor.cs
Normal file
12
LawCompany/LawCompanyDatabaseImplement/Models/Guarantor.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
internal class Guarantor
|
||||
{
|
||||
}
|
||||
}
|
12
LawCompany/LawCompanyDatabaseImplement/Models/Hearing.cs
Normal file
12
LawCompany/LawCompanyDatabaseImplement/Models/Hearing.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
internal class Hearing
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
internal class HearingLawyer
|
||||
{
|
||||
}
|
||||
}
|
12
LawCompany/LawCompanyDatabaseImplement/Models/Lawyer.cs
Normal file
12
LawCompany/LawCompanyDatabaseImplement/Models/Lawyer.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LawCompanyDatabaseImplement.Models
|
||||
{
|
||||
internal class Lawyer
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user