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" - >Добавить участника + >Добавить участников