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 @@
Название:
- +
Цена:
- +