поручитель in progress

This commit is contained in:
sofiaivv 2024-05-01 17:18:02 +04:00
parent f0c9e40194
commit 4c59888ee6
11 changed files with 123 additions and 15 deletions

View File

@ -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; }
}
}

View File

@ -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)
{

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View 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 Consultation
{
}
}

View 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 ConsultationLawyer
{
}
}

View 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
{
}
}

View 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
{
}
}

View 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 HearingLawyer
{
}
}

View 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
{
}
}