From 39a06e6150e699098dfb04b0b653dd462ba865f8 Mon Sep 17 00:00:00 2001 From: Yunusov_Niyaz Date: Sat, 25 May 2024 15:19:45 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B6=D0=B8=D0=B2=D0=BE=D1=82=D0=BD=D1=8B?= =?UTF-8?q?=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VeterinaryRestApi/Controllers/DrugController.cs | 4 ++-- .../VeterinaryRestApi/Controllers/PetController.cs | 13 +++++++++++++ .../Controllers/HomeController.cs | 3 +-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs b/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs index 1378f1d..f100846 100644 --- a/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs +++ b/VeterinaryView/VeterinaryRestApi/Controllers/DrugController.cs @@ -47,7 +47,7 @@ namespace VeterinaryRestApi.Controllers } catch (Exception ex) { - _logger.LogError(ex, "Ошибка получения продукта по id={Id}",drugId); + _logger.LogError(ex, "Ошибка получения лекарства по id={Id}",drugId); throw; } } @@ -61,7 +61,7 @@ namespace VeterinaryRestApi.Controllers } catch (Exception ex) { - _logger.LogError(ex, "Ошибка получения списка лекартсв"); + _logger.LogError(ex, "Ошибка получения списка лекарств"); throw; } } diff --git a/VeterinaryView/VeterinaryRestApi/Controllers/PetController.cs b/VeterinaryView/VeterinaryRestApi/Controllers/PetController.cs index 859251b..0f3c0c2 100644 --- a/VeterinaryView/VeterinaryRestApi/Controllers/PetController.cs +++ b/VeterinaryView/VeterinaryRestApi/Controllers/PetController.cs @@ -31,6 +31,19 @@ namespace VeterinaryRestApi.Controllers throw; } } + [HttpGet] + public PetViewModel? GetPet(int ownerId) + { + try + { + return _pet.ReadElement(new PetSearchModel { Id = ownerId }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка получения животного по id={Id}", ownerId); + throw; + } + } [HttpPost] public bool CreatePet(PetBindingModel model) { diff --git a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs index 4cd6e3c..c2412fb 100644 --- a/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs +++ b/VeterinaryView/VeterinaryShowOwnerApp/Controllers/HomeController.cs @@ -188,9 +188,8 @@ namespace VeterinaryShowOwnerApp.Controllers PetType = type, PetBreed = breed, PetGender = gender, - OwnerId = APIOwner.Owner.Id, }); - Response.Redirect("Index"); + Response.Redirect("Pets"); } [HttpGet] public Tuple>? GetPet(int petId)