From 05c9929870e394fdb2a05142197456592306eb4b Mon Sep 17 00:00:00 2001 From: antoc0der <1@DESKTOP-K1L8ND3> Date: Mon, 29 Apr 2024 15:54:13 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=80=D1=83=D1=87=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C.=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=BC?= =?UTF-8?q?=D0=B5=D0=B4=D0=B8=D0=BA=D0=B0=D0=BC=D0=B5=D0=BD=D1=82=D1=8B=20?= =?UTF-8?q?=D0=BD=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/MedicationStorage.cs | 9 +++------ .../Views/Home/UpdateMedication.cshtml | 16 +--------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs b/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs index b6c967d..89b1c78 100644 --- a/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs +++ b/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs @@ -25,13 +25,10 @@ namespace VeterinaryDatabaseImplement.Implements } public List GetFilteredList(MedicationSearchModel model) { - if (string.IsNullOrEmpty(model.MedicationName)) - { - return new(); - } + using var context = new VeterinaryDatabase(); - return context.Medications - .Where(x => x.MedicationName.Contains(model.MedicationName)) + return context.Medications.Where(x=>x.DoctorId == model.DoctorId) + .Where(x => String.IsNullOrEmpty(model.MedicationName) || x.MedicationName.Contains(model.MedicationName)) .Select(x => x.GetViewModel) .ToList(); } diff --git a/VeterinaryView/VeterinaryShowDoctorApp/Views/Home/UpdateMedication.cshtml b/VeterinaryView/VeterinaryShowDoctorApp/Views/Home/UpdateMedication.cshtml index 2485c8c..0fa3c06 100644 --- a/VeterinaryView/VeterinaryShowDoctorApp/Views/Home/UpdateMedication.cshtml +++ b/VeterinaryView/VeterinaryShowDoctorApp/Views/Home/UpdateMedication.cshtml @@ -13,9 +13,6 @@
-
- -
Название:
@@ -26,17 +23,7 @@
- - - - - - - - -
- Животное -
+
@@ -56,7 +43,6 @@ success: function (result) { $('#name').val(result.item1.medicationName); $('#price').val(result.item1.price); - $('#table-elements').html(result.item2); } }); };