From efb32b4b7e56982f61492b5304708bc414038c3d Mon Sep 17 00:00:00 2001 From: AnnZhimol Date: Fri, 19 May 2023 13:26:52 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B5=D1=81=D0=BA=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=BA=D0=B8=D1=85=20=D1=83=D1=87=D0=B0=D1=81=D1=82=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2=20=D0=BA=20=D0=BF=D0=BB=D0=B0=D0=BD=D1=83=20?= =?UTF-8?q?=D0=BF=D0=B8=D1=82=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 15 ++-- .../Views/Home/AddMemberToMealPlan.cshtml | 69 ++++++++++++++++--- .../Views/Home/ListMealPlans.cshtml | 2 +- 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/Hotel/HotelOrganiserApp/Controllers/HomeController.cs b/Hotel/HotelOrganiserApp/Controllers/HomeController.cs index 5eb9e17..1f354af 100644 --- a/Hotel/HotelOrganiserApp/Controllers/HomeController.cs +++ b/Hotel/HotelOrganiserApp/Controllers/HomeController.cs @@ -359,22 +359,25 @@ namespace HotelOrganiserApp.Controllers { return Redirect("~/Home/Enter"); } - ViewBag.MealPlans = APIClient.GetRequest>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}"); - ViewBag.Members = APIClient.GetRequest>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}"); + 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] - public void AddMemberToMealPlan(int mealPlan, int member) + public void AddMemberToMealPlan(int mealPlan, int[] member) { if (APIClient.Organiser == null) { throw new Exception("Необходима авторизация"); } - APIClient.PostRequest("api/main/AddMemberToMealPlan", Tuple.Create( + for (int i = 0; i < member.Length; i++) + { + APIClient.PostRequest("api/main/AddMemberToMealPlan", Tuple.Create( new MealPlanSearchModel() { Id = mealPlan }, - new MemberViewModel() { Id = member } - )); + new MemberViewModel() { Id = member[i] } + )); + } Response.Redirect("ListMealPlans"); } diff --git a/Hotel/HotelOrganiserApp/Views/Home/AddMemberToMealPlan.cshtml b/Hotel/HotelOrganiserApp/Views/Home/AddMemberToMealPlan.cshtml index f3cf2fe..102eee5 100644 --- a/Hotel/HotelOrganiserApp/Views/Home/AddMemberToMealPlan.cshtml +++ b/Hotel/HotelOrganiserApp/Views/Home/AddMemberToMealPlan.cshtml @@ -4,24 +4,73 @@ @{ ViewData["Title"] = "AddMemberToMealPlan"; } - -@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/ListMealPlans.cshtml b/Hotel/HotelOrganiserApp/Views/Home/ListMealPlans.cshtml index 74ecd54..65ce4d1 100644 --- a/Hotel/HotelOrganiserApp/Views/Home/ListMealPlans.cshtml +++ b/Hotel/HotelOrganiserApp/Views/Home/ListMealPlans.cshtml @@ -82,7 +82,7 @@ asp-area="" asp-controller="Home" asp-action="AddMemberToMealPlan" 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" - >Добавить участника + >Добавить участников