diff --git a/LawCompany/LawCompanyContracts/SearchModels/HearingSearchModel.cs b/LawCompany/LawCompanyContracts/SearchModels/HearingSearchModel.cs index 583e594..8a2e72c 100644 --- a/LawCompany/LawCompanyContracts/SearchModels/HearingSearchModel.cs +++ b/LawCompany/LawCompanyContracts/SearchModels/HearingSearchModel.cs @@ -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; } } } diff --git a/LawCompany/LawCompanyDatabaseImplement/Implements/ConsultationStorage.cs b/LawCompany/LawCompanyDatabaseImplement/Implements/ConsultationStorage.cs index 81d75e7..d9aff02 100644 --- a/LawCompany/LawCompanyDatabaseImplement/Implements/ConsultationStorage.cs +++ b/LawCompany/LawCompanyDatabaseImplement/Implements/ConsultationStorage.cs @@ -21,17 +21,17 @@ namespace LawCompanyDatabaseImplement.Implements } public List 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) { diff --git a/LawCompany/LawCompanyDatabaseImplement/Implements/GuarantorStorage.cs b/LawCompany/LawCompanyDatabaseImplement/Implements/GuarantorStorage.cs new file mode 100644 index 0000000..08433df --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Implements/GuarantorStorage.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs b/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs new file mode 100644 index 0000000..89dbe62 --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Implements/HearingStorage.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Implements/LawyerStorage.cs b/LawCompany/LawCompanyDatabaseImplement/Implements/LawyerStorage.cs new file mode 100644 index 0000000..d8a6120 --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Implements/LawyerStorage.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Models/Consultation.cs b/LawCompany/LawCompanyDatabaseImplement/Models/Consultation.cs new file mode 100644 index 0000000..7eb846e --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Models/Consultation.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Models/ConsultationLawyer.cs b/LawCompany/LawCompanyDatabaseImplement/Models/ConsultationLawyer.cs new file mode 100644 index 0000000..1ce5c5b --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Models/ConsultationLawyer.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Models/Guarantor.cs b/LawCompany/LawCompanyDatabaseImplement/Models/Guarantor.cs new file mode 100644 index 0000000..d687b95 --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Models/Guarantor.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Models/Hearing.cs b/LawCompany/LawCompanyDatabaseImplement/Models/Hearing.cs new file mode 100644 index 0000000..a538f10 --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Models/Hearing.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Models/HearingLawyer.cs b/LawCompany/LawCompanyDatabaseImplement/Models/HearingLawyer.cs new file mode 100644 index 0000000..dae9a83 --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Models/HearingLawyer.cs @@ -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 + { + } +} diff --git a/LawCompany/LawCompanyDatabaseImplement/Models/Lawyer.cs b/LawCompany/LawCompanyDatabaseImplement/Models/Lawyer.cs new file mode 100644 index 0000000..84c79f1 --- /dev/null +++ b/LawCompany/LawCompanyDatabaseImplement/Models/Lawyer.cs @@ -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 + { + } +}