From 54c3ec41b0dda29ba4df422481f44a4165263583 Mon Sep 17 00:00:00 2001 From: prodigygirl Date: Fri, 7 Apr 2023 13:20:11 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HospitalDatabaseImplement/Implements/MedicineStorage.cs | 4 ++-- .../Implements/PrescriptionStorage.cs | 3 ++- .../HospitalDatabaseImplement/Implements/RecipeStorage.cs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs b/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs index 369059c..c06f73c 100644 --- a/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs +++ b/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs @@ -25,13 +25,13 @@ namespace HospitalDatabaseImplement.Implements public List GetFilteredList(MedicineSearchModel model) { - if (string.IsNullOrEmpty(model.Name)) + if (!model.ApothecaryId.HasValue) { return new(); } using var context = new HospitalDatabase(); return context.Medicines.Include(x => x.Apothecary) - .Where(x => x.Name.Contains(model.Name)) + .Where(x => x.ApothecaryId == model.ApothecaryId) .Select(x => x.GetViewModel) .ToList(); } diff --git a/Hospital/HospitalDatabaseImplement/Implements/PrescriptionStorage.cs b/Hospital/HospitalDatabaseImplement/Implements/PrescriptionStorage.cs index c05cfe4..57753c4 100644 --- a/Hospital/HospitalDatabaseImplement/Implements/PrescriptionStorage.cs +++ b/Hospital/HospitalDatabaseImplement/Implements/PrescriptionStorage.cs @@ -29,7 +29,8 @@ namespace HospitalDatabaseImplement.Implements } using var context = new HospitalDatabase(); return context.Prescriptions.Include(x => x.Apothecary).Include(x => x.Medicine) - .Where(x => x.Id == model.Id || x.ApothecaryId == model.ApothecaryId || (model.DateFrom <= x.Date && x.Date <= model.DateTo)) + .Where(x => x.Id == model.Id || x.ApothecaryId == model.ApothecaryId + || (model.DateFrom <= x.Date && x.Date <= model.DateTo)) // ищем либо по аптекарю, либо по периоду .Select(x => x.GetViewModel) .ToList(); } diff --git a/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs b/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs index 41cdd8b..09303bd 100644 --- a/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs +++ b/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs @@ -29,7 +29,7 @@ namespace HospitalDatabaseImplement.Implements public List GetFilteredList(RecipeSearchModel model) { - if (string.IsNullOrEmpty(model.Name) || !model.ApothecaryId.HasValue) + if (!model.ApothecaryId.HasValue) { return new(); } @@ -39,7 +39,7 @@ namespace HospitalDatabaseImplement.Implements .ThenInclude(x => x.Treatment) .Include(x => x.Medicines) .ThenInclude(x => x.Medicine) - .Where(x => x.Name.Contains(model.Name) || x.ApothecaryId == model.ApothecaryId) + .Where(x => x.ApothecaryId == model.ApothecaryId) // поиск по аптекарю .ToList() .Select(x => x.GetViewModel) .ToList();