From 8003d8f7f904f85c66218f9a83fdc50a3f0d9d07 Mon Sep 17 00:00:00 2001 From: gg12 darfren Date: Sat, 27 Apr 2024 15:06:33 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B2=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PharmacistApp/Controllers/HomeController.cs | 4 ++-- VetClinic/PharmacistApp/Program.cs | 2 +- .../Views/Home/UpdateMedicine.cshtml | 17 ++++++++--------- .../Models/Medicine.cs | 1 + .../VetClinicDatabase .cs | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/VetClinic/PharmacistApp/Controllers/HomeController.cs b/VetClinic/PharmacistApp/Controllers/HomeController.cs index 0edecba..cc042bc 100644 --- a/VetClinic/PharmacistApp/Controllers/HomeController.cs +++ b/VetClinic/PharmacistApp/Controllers/HomeController.cs @@ -117,7 +117,7 @@ View(APIPharmacist.GetRequest>($"api/medicine/getmedicin { return Redirect("~/Home/Enter"); } - ViewBag.Animals = APIPharmacist.GetRequest>($"api/animal/getanimals"); + ViewBag.Animals = APIPharmacist.GetRequest>($"api/animal/getanimallist"); return View(); } @@ -182,7 +182,7 @@ View(APIPharmacist.GetRequest>($"api/medicine/getmedicin return Redirect("~/Home/Enter"); } ViewBag.Medicines = APIPharmacist.GetRequest>($"api/medicine/getmedicines?pharmacistid={APIPharmacist.Pharmacist.Id}"); - ViewBag.Animals = APIPharmacist.GetRequest>($"api/animal/getanimals"); + ViewBag.Animals = APIPharmacist.GetRequest>($"api/animal/getanimallist"); return View(); } diff --git a/VetClinic/PharmacistApp/Program.cs b/VetClinic/PharmacistApp/Program.cs index 934998a..57900d3 100644 --- a/VetClinic/PharmacistApp/Program.cs +++ b/VetClinic/PharmacistApp/Program.cs @@ -7,7 +7,7 @@ builder.Services.AddControllersWithViews(); var app = builder.Build(); -APIAdmin.Connect(builder.Configuration); +APIPharmacist.Connect(builder.Configuration); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { diff --git a/VetClinic/PharmacistApp/Views/Home/UpdateMedicine.cshtml b/VetClinic/PharmacistApp/Views/Home/UpdateMedicine.cshtml index 8f327cf..c9d851a 100644 --- a/VetClinic/PharmacistApp/Views/Home/UpdateMedicine.cshtml +++ b/VetClinic/PharmacistApp/Views/Home/UpdateMedicine.cshtml @@ -51,15 +51,14 @@ success: function (result) { $('#name').val(result.item1.medicineName); $('#price').val(result.item1.price); - $('#animals-elements').html - @foreach (var animal in ViewBag.Animals) - { - $($"#select option[value={animal.Id}]").prop('selected', false); - } - @foreach (var animal in result.Item2) - { - $($"#select option[value={animal.id}]").prop('selected', true); - } + // @foreach (var animal in ViewBag.Animals) + // { + // $($"#select option[value={animal.Id}]").prop('selected', false); + // } + // @foreach (var animal in result.Item2) + // { + // $($"#select option[value={animal.id}]").prop('selected', true); + // } } }); }; diff --git a/VetClinic/VetClinicDataBaseImplement/Models/Medicine.cs b/VetClinic/VetClinicDataBaseImplement/Models/Medicine.cs index 9861078..acc693e 100644 --- a/VetClinic/VetClinicDataBaseImplement/Models/Medicine.cs +++ b/VetClinic/VetClinicDataBaseImplement/Models/Medicine.cs @@ -54,6 +54,7 @@ namespace VetClinicDataBaseImplement.Models { Animal = context.Animals.First(y => y.Id == x.Key), }).ToList(), + PharmacistId = model.PharmacistId, Pharmacist = context.Pharmacists.First(x => x.Id == model.PharmacistId) }; } diff --git a/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs b/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs index 1d9e6df..3aa2bb9 100644 --- a/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs +++ b/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs @@ -11,7 +11,7 @@ namespace VetClinicDataBaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS02;Initial Catalog=VetClinicDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=VetClinicDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); }