From 1236effc786294e05bb87e0fa0a4ac0ee41f5338 Mon Sep 17 00:00:00 2001 From: AnnZhimol Date: Fri, 19 May 2023 17:15:42 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D0=B5=D1=86!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 19 ++--- .../Views/Home/AddMemberToConference.cshtml | 70 ++++++++++++++++--- .../Views/Home/ListConferences.cshtml | 2 +- 3 files changed, 71 insertions(+), 20 deletions(-) diff --git a/Hotel/HotelOrganiserApp/Controllers/HomeController.cs b/Hotel/HotelOrganiserApp/Controllers/HomeController.cs index a825f25..1c77e9c 100644 --- a/Hotel/HotelOrganiserApp/Controllers/HomeController.cs +++ b/Hotel/HotelOrganiserApp/Controllers/HomeController.cs @@ -373,7 +373,6 @@ namespace HotelOrganiserApp.Controllers } return View(Tuple.Create(APIClient.GetRequest>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}"), APIClient.GetRequest>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}"))); - return View(); } [HttpPost] @@ -659,22 +658,24 @@ namespace HotelOrganiserApp.Controllers { return Redirect("~/Home/Enter"); } - ViewBag.Conferences = APIClient.GetRequest>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}"); - ViewBag.Members = APIClient.GetRequest>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}"); - return View(); + return View(Tuple.Create(APIClient.GetRequest>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}"), + APIClient.GetRequest>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}"))); } [HttpPost] - public void AddMemberToConference(int conference, int member) + public void AddMemberToConference(int conference, int[] member) { if (APIClient.Organiser == null) { throw new Exception("Необходима авторизация"); } - APIClient.PostRequest("api/main/AddMemberToConference", Tuple.Create( - new ConferenceSearchModel() { Id = conference }, - new MemberViewModel() { Id = member } - )); + for (int i = 0; i < member.Length; i++) + { + APIClient.PostRequest("api/main/AddMemberToConference", Tuple.Create( + new ConferenceSearchModel() { Id = conference }, + new MemberViewModel() { Id = member[i] } + )); + } Response.Redirect("ListConferences"); } diff --git a/Hotel/HotelOrganiserApp/Views/Home/AddMemberToConference.cshtml b/Hotel/HotelOrganiserApp/Views/Home/AddMemberToConference.cshtml index c9bade2..33ebee7 100644 --- a/Hotel/HotelOrganiserApp/Views/Home/AddMemberToConference.cshtml +++ b/Hotel/HotelOrganiserApp/Views/Home/AddMemberToConference.cshtml @@ -5,23 +5,73 @@ ViewData["Title"] = "AddMemberToConference"; } -@model Dictionary +@model Tuple, List>
- +
- -
-
-
- -
- +
+ +
+
+
+ + + + + + + + + + + + + + + @foreach (var item in Model.Item2) + { + + + + + + } + +
+ + + ФИО участника + + Гражданство +
+ + + @Html.DisplayFor(modelItem => item.MemberFIO) + + @Html.DisplayFor(modelItem => item.Citizenship) +
+
+
+
-
+
\ No newline at end of file diff --git a/Hotel/HotelOrganiserApp/Views/Home/ListConferences.cshtml b/Hotel/HotelOrganiserApp/Views/Home/ListConferences.cshtml index 4c0e200..dd27600 100644 --- a/Hotel/HotelOrganiserApp/Views/Home/ListConferences.cshtml +++ b/Hotel/HotelOrganiserApp/Views/Home/ListConferences.cshtml @@ -84,7 +84,7 @@ asp-area="" asp-controller="Home" asp-action="AddMemberToConference" style="padding: 10 px" class="u-active-custom-color-6 u-border-none u-btn u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" - >Добавить участника + >Добавить участников