From 6ba7695422b8c1a55a6bf6162a20c95ef3bd2bdd Mon Sep 17 00:00:00 2001 From: antoc0der <1@DESKTOP-K1L8ND3> Date: Thu, 23 May 2024 21:43:55 +0400 Subject: [PATCH] =?UTF-8?q?=D1=83=D1=80=D0=B0!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DoctorController.cs | 14 ++++++++++++++ .../Controllers/HomeController.cs | 5 ++++- .../Views/Home/CreateVisit.cshtml | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/VeterinaryView/VeterinaryRestApi/Controllers/DoctorController.cs b/VeterinaryView/VeterinaryRestApi/Controllers/DoctorController.cs index 5be904f..ccec81f 100644 --- a/VeterinaryView/VeterinaryRestApi/Controllers/DoctorController.cs +++ b/VeterinaryView/VeterinaryRestApi/Controllers/DoctorController.cs @@ -3,6 +3,7 @@ using VeterinaryContracts.BindingModels; using VeterinaryContracts.BusinessLogicContracts; using VeterinaryContracts.SearchModels; using VeterinaryContracts.ViewModels; +using VeterinaryDatabaseImplement.Models; namespace VeterinaryRestApi.Controllers { @@ -60,5 +61,18 @@ namespace VeterinaryRestApi.Controllers throw; } } + [HttpGet] + public List GetDoctors() + { + try + { + return _logic.ReadList(null); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения списка врачей"); + throw; + } + } } } diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs index f20df00..1ee56dd 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs +++ b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs @@ -221,11 +221,12 @@ namespace VeterinaryShowOwnerApp.Controllers return Redirect("~/Home/Enter"); } ViewBag.Pets = APIOwner.GetRequest>($"api/pet/getpets?ownerid={APIOwner.Owner.Id}"); + ViewBag.Doctors = APIOwner.GetRequest>($"api/doctor/getdoctors"); return View(); } [HttpPost] - public void CreateVisit(string name, List pets, DateTime dateTime) + public void CreateVisit(string name, List pets, DateTime dateTime, int doctor) { if (APIOwner.Owner == null) { @@ -245,6 +246,8 @@ namespace VeterinaryShowOwnerApp.Controllers VisitName = name, VisitPet = a, DateVisit = dateTime, + DoctorId = doctor, + OwnerId = APIOwner.Owner.Id, }); Response.Redirect("Index"); } diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/CreateVisit.cshtml b/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/CreateVisit.cshtml index ddd1b92..15dff1b 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/CreateVisit.cshtml +++ b/VeterinaryView/VeterinaryShowOwnerApp/Views/Home/CreateVisit.cshtml @@ -18,6 +18,12 @@ +
+
Врач:
+
+ +
+
Животные: