diff --git a/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs b/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs index 45eeedb..9c8eb70 100644 --- a/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs +++ b/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs @@ -266,22 +266,24 @@ namespace HostrelHeadwaiterApp.Controllers { return Redirect("~/Home/Enter"); } - ViewBag.Rooms = APIClient.GetRequest>($"api/main/getroomlist?headwaiterId={APIClient.Headwaiter.Id}"); - ViewBag.Dinners = APIClient.GetRequest>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}"); - return View(); + return View(Tuple.Create(APIClient.GetRequest>($"api/main/getroomlist?headwaiterId={APIClient.Headwaiter.Id}"), + APIClient.GetRequest>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}"))); } [HttpPost] - public void AddDinnerToRoom(int room, int dinner) + public void AddDinnerToRoom(int room, int[] dinner) { if (APIClient.Headwaiter == null) { throw new Exception("Необходима авторизация"); } - APIClient.PostRequest("api/main/AddDinnerToRoom", Tuple.Create( - new RoomSearchModel() { Id = room }, - new DinnerViewModel() { Id = dinner } - )); + for (int i = 0; i < dinner.Length; i++) + { + APIClient.PostRequest("api/main/AddDinnerToRoom", Tuple.Create( + new RoomSearchModel() { Id = room }, + new DinnerViewModel() { Id = dinner[i] } + )); + } Response.Redirect("ListRooms"); } @@ -504,7 +506,7 @@ namespace HostrelHeadwaiterApp.Controllers return Redirect("~/Home/Enter"); } return View(Tuple.Create(APIClient.GetRequest>($"api/main/getconferencebookinglist?headwaiterId={APIClient.Headwaiter.Id}"), - APIClient.GetRequest>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}"))); return View(); + APIClient.GetRequest>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}"))); } [HttpPost] diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToRoom.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToRoom.cshtml index 2c3b52b..9fe42aa 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToRoom.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToRoom.cshtml @@ -1,29 +1,77 @@ -@using HotelContracts.ViewModels; +@using HotelContracts.ViewModels; @using HotelDataModels.Models; @{ ViewData["Title"] = "AddDinnerToRoom"; } -@model Dictionary +@model Tuple, List>
- +
- +
-
- -
- -
+ +
+
+
+ + + + + + + + + + + + + + + @foreach (var item in Model.Item2) + { + + + + + + } + +
+ + + ФИО участника + + Гражданство +
+ + + @Html.DisplayFor(modelItem => item.DinnerName) + + @Html.DisplayFor(modelItem => item.DinnerPrice) +
+
+
+
+
+
+
- -
-
- -
- \ No newline at end of file