From a3bdba6c2cea85696ec9fa322b83c82f4ec0c8a4 Mon Sep 17 00:00:00 2001 From: goblinrf Date: Sat, 25 May 2024 13:30:44 +0400 Subject: [PATCH] =?UTF-8?q?"=D0=A1=D1=82=D0=B8=D0=BB=D1=8C=20=E2=80=94=20?= =?UTF-8?q?=D1=8D=D1=82=D0=BE=20=D0=B2=D1=81=D0=B5.=20=D0=AD=D1=82=D0=BE?= =?UTF-8?q?=20=D1=81=D0=B2=D0=B5=D0=B6=D0=B8=D0=B9=20=D0=B2=D0=B7=D0=B3?= =?UTF-8?q?=D0=BB=D1=8F=D0=B4=20=D0=BD=D0=B0=20=D1=81=D0=BA=D1=83=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=D0=B5=20=D0=B8=20=D0=BE=D0=BF=D0=B0=D1=81=D0=BD?= =?UTF-8?q?=D0=BE=D0=B5.=20=D0=A1=D1=82=D0=B8=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5,=20=D0=BD=D0=BE=20=D1=81=D0=BA=D1=83=D1=87=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BB=D1=83=D1=87=D1=88=D0=B5,=20=D1=87=D0=B5=D0=BC?= =?UTF-8?q?=20=D0=BE=D0=BF=D0=B0=D1=81=D0=BD=D1=8B=D0=B5,=20=D0=BD=D0=BE?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D1=81=D1=82=D0=B8=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5.=20=D0=9E=D0=BF=D0=B0=D1=81=D0=BD=D1=8B=D0=B5=20=D0=B8?= =?UTF-8?q?=20=D1=81=D1=82=D0=B8=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=E2=80=94?= =?UTF-8?q?=20=D1=8D=D1=82=D0=BE=20=D0=B8=D1=81=D0=BA=D1=83=D1=81=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=BE...=D0=A1=D1=82=D0=B8=D0=BB=D1=8C=20=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BD=D0=B5=20=D1=83=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D1=85,=20=D0=BD=D0=B5=20=D0=B2=D1=81=D0=B5=20=D0=B5=D0=BC?= =?UTF-8?q?=D1=83=20=D0=B2=D0=B5=D1=80=D0=BD=D1=8B.=20"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit — Чарльз Буковски --- .../Controllers/HomeController.cs | 22 ++++++++++++++----- .../Views/Home/UpdateVaccination.cshtml | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/VetClinic/VetClinicAdminApp/Controllers/HomeController.cs b/VetClinic/VetClinicAdminApp/Controllers/HomeController.cs index 55e19d7..4087030 100644 --- a/VetClinic/VetClinicAdminApp/Controllers/HomeController.cs +++ b/VetClinic/VetClinicAdminApp/Controllers/HomeController.cs @@ -166,7 +166,7 @@ View(APIAdmin.GetRequest>($"api/vaccination/getvaccin } [HttpPost] - public void Create(string name, DateTime date) + public void Create(string name, DateTime date, List services) { if (APIAdmin.Admin == null) { @@ -176,11 +176,17 @@ View(APIAdmin.GetRequest>($"api/vaccination/getvaccin { throw new Exception("Ошибка в введенных данных"); } + Dictionary a = new Dictionary(); + foreach (int service in services) + { + a.Add(service, new ServiceSearchModel { Id = service } as IServiceModel); + } APIAdmin.PostRequest("api/visit/createvisit", new VisitBindingModel { NameVisit = name, DateVisit = date, - AdminId = APIAdmin.Admin.Id + AdminId = APIAdmin.Admin.Id, + ServiceVisits = a }); Response.Redirect("Index"); } @@ -330,7 +336,7 @@ View(APIAdmin.GetRequest>($"api/vaccination/getvaccin } [HttpPost] - public void Update(int visit, string name, DateTime date) + public void Update(int visit, string name, DateTime date, List services) { if (APIAdmin.Admin == null) { @@ -340,12 +346,18 @@ View(APIAdmin.GetRequest>($"api/vaccination/getvaccin { throw new Exception("Ошибка в введенных данных"); } + Dictionary a = new Dictionary(); + foreach (int service in services) + { + a.Add(service, new ServiceSearchModel { Id = service } as IServiceModel); + } APIAdmin.PostRequest("api/visit/updatevisit", new VisitBindingModel { Id = visit, NameVisit = name, AdminId = APIAdmin.Admin.Id, DateVisit = date, + ServiceVisits = a }); Response.Redirect("Index"); } @@ -569,13 +581,13 @@ View(res); return result; } [HttpGet] - public VaccinationViewModel GetVaccination(int adminId) + public VaccinationViewModel GetVaccination(int vaccinationId) { if (APIAdmin.Admin == null) { throw new Exception("Âû êàê ñþäà ïîïàëè? Ñþäà âõîä òîëüêî àâòîðèçîâàííûì"); } - var result = APIAdmin.GetRequest($"api/vaccination/getvaccination?adminid={adminId}"); + var result = APIAdmin.GetRequest($"api/vaccination/getvaccination?vaccinationid={vaccinationId}"); if (result == null) { return default; diff --git a/VetClinic/VetClinicAdminApp/Views/Home/UpdateVaccination.cshtml b/VetClinic/VetClinicAdminApp/Views/Home/UpdateVaccination.cshtml index dbb88f5..499767f 100644 --- a/VetClinic/VetClinicAdminApp/Views/Home/UpdateVaccination.cshtml +++ b/VetClinic/VetClinicAdminApp/Views/Home/UpdateVaccination.cshtml @@ -26,13 +26,13 @@
Название:
- +
Цена:
- +