From 7541ee815e75fb9f97f2d9ae60b3567fcd08e0cb Mon Sep 17 00:00:00 2001 From: antoc0der <1@DESKTOP-K1L8ND3> Date: Sun, 26 May 2024 22:29:54 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20=D0=BE?= =?UTF-8?q?=D1=82=D1=87=D0=B5=D1=82=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/MedicationStorage.cs | 2 +- .../VeterinaryRestApi/Controllers/DrugController.cs | 10 ++++++---- .../Controllers/HomeController.cs | 8 ++++---- .../Controllers/HomeController.cs | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs b/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs index 9a9e1bb..24b89a8 100644 --- a/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs +++ b/VeterinaryView/VeterinaryDatabaseImplement/Implements/MedicationStorage.cs @@ -96,7 +96,7 @@ namespace VeterinaryDatabaseImplement.Implements { MedicationName = medication.MedicationName, Purchases = context.Purchases.Include(purchase => purchase.Drug).ThenInclude(drug => drug.Medications) - .Where(purchase => purchase.Drug != null && purchase.Drug.Medications.Select(x => x.MedicationId).ToList().Contains(medication.Id)) + .Where(purchase => purchase.Drug != null && purchase.Drug.Medications.Any(m => m.MedicationId == medication.Id)) .Select(purchase => purchase.GetViewModel).ToList() }).ToList(); } diff --git a/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs b/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs index d013e3e..e6852ee 100644 --- a/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs +++ b/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs @@ -41,10 +41,12 @@ namespace VeterinaryRestApi.Controllers { try { - return _drug.ReadElement(new DrugSearchModel - { - Id =drugId - }); + var elem = _drug.ReadElement(new DrugSearchModel{Id =drugId}); + if (elem == null) + return null; + elem.DrugMedications = null!; + return elem; + } catch (Exception ex) { diff --git a/VeterinaryView/VeterinaryShowDoctorApp/Controllers/HomeController.cs b/VeterinaryView/VeterinaryShowDoctorApp/Controllers/HomeController.cs index 5d8a7cb..9f3396c 100644 --- a/VeterinaryView/VeterinaryShowDoctorApp/Controllers/HomeController.cs +++ b/VeterinaryView/VeterinaryShowDoctorApp/Controllers/HomeController.cs @@ -498,7 +498,7 @@ namespace VeterinaryShowDoctorApp.Controllers APIDoctor.PostRequest("api/report/createpurchaselistwordfile", new ReportPurchaseMedicationBindingModel { Medications = medications, - FileName = "C:\\ReportsCourseWork\\wordfile.docx" + FileName = "C:\\Users\\1\\Downloads\\wordfile.docx" }); Response.Redirect("GetWordFile"); } @@ -507,7 +507,7 @@ namespace VeterinaryShowDoctorApp.Controllers APIDoctor.PostRequest("api/report/createpurchaselistexcelfile", new ReportPurchaseMedicationBindingModel { Medications = medications, - FileName = "C:\\ReportsCourseWork\\excelfile.xlsx" + FileName = "C:\\Users\\1\\Downloads\\excelfile.xlsx" }); Response.Redirect("GetExcelFile"); } @@ -516,12 +516,12 @@ namespace VeterinaryShowDoctorApp.Controllers [HttpGet] public IActionResult GetWordFile() { - return new PhysicalFileResult("C:\\ReportsCourseWork\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + return new PhysicalFileResult("C:\\Users\\1\\Downloads\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); } public IActionResult GetExcelFile() { - return new PhysicalFileResult("C:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + return new PhysicalFileResult("C:\\Users\\1\\Downloads\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); } [HttpGet] public IActionResult Report() diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs index d125e5c..09cf28b 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs +++ b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs @@ -342,7 +342,7 @@ namespace VeterinaryShowOwnerApp.Controllers return Redirect("~/Home/Enter"); } ViewBag.Pets = APIOwner.GetRequest>($"api/pet/getpets?ownerid={APIOwner.Owner.Id}"); - ViewBag.Drugs = APIOwner.GetRequest>($"api/drug/getalldrugs"); + ViewBag.Drugs = APIOwner.GetRequest>($"api/drug/getdrugs?doctorid={null}"); return View(); } [HttpPost]