diff --git a/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs b/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs index 0683845..45eeedb 100644 --- a/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs +++ b/Hotel/HostrelHeadwaiterApp/Controllers/HomeController.cs @@ -503,24 +503,27 @@ namespace HostrelHeadwaiterApp.Controllers { return Redirect("~/Home/Enter"); } - ViewBag.ConferenceBookings = APIClient.GetRequest>($"api/main/getconferenceBookinglist?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/getconferencebookinglist?headwaiterId={APIClient.Headwaiter.Id}"), + APIClient.GetRequest>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}"))); return View(); } [HttpPost] - public void AddDinnerToConferenceBooking(int conferenceBooking, int dinner) + public void AddDinnerToConferenceBooking(int conferenceBooking, int[] dinner) { if (APIClient.Headwaiter == null) { throw new Exception("Необходима авторизация"); } - APIClient.PostRequest("api/main/AddDinnerToConferenceBooking", Tuple.Create( + for (int i = 0; i < dinner.Length; i++) + { + APIClient.PostRequest("api/main/AddDinnerToConferenceBooking", Tuple.Create( new ConferenceBookingSearchModel() { Id = conferenceBooking }, - new DinnerViewModel() { Id = dinner } + new DinnerViewModel() { Id = dinner[i] } )); + } Response.Redirect("ListConferenceBookings"); } + public IActionResult ListConferenceBookings() { @@ -693,30 +696,41 @@ namespace HostrelHeadwaiterApp.Controllers _logger.LogError(ex, "Ошибка создания отчета"); throw; } + double sum = 0; string table = ""; + table += $"

Предварительный отчет

"; + table += $""; + table += ""; + table += ""; + table += ""; + table += ""; + table += ""; + table += ""; + table += ""; + table += ""; + table += ""; + table += $""; + table += $""; + table += $""; + table += $""; + table += $""; + table += ""; + table += ""; foreach (var report in result) { - table += $"

{report.DinnerName}

"; - table += $"
ОбедИмя комнатыЦена комнатыНазвание залаДата броинирования
"; - table += ""; - table += ""; - table += $""; - table += $""; - table += $""; - table += $""; - table += ""; - table += ""; - table += ""; - table += ""; - table += $""; - table += $""; - table += $""; - table += $""; + table += ""; + table += ""; + table += $""; + table += $""; + table += $""; + table += $""; + table += $""; table += ""; table += ""; - table += "
Имя комнатыЦена комнатыНазвание залаДата броинирования
{report.RoomName}{report.RoomPrice}{report.NameHall}{report.BookingDate}
{report.DinnerName}{report.RoomName}{report.RoomPrice}{report.NameHall}{report.BookingDate}
"; + sum += report.RoomPrice; } - //table += $"

Итого: {result.Item2}

"; + table += ""; + table += $"

Итого: {sum}

"; return table; } } diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToConferenceBooking.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToConferenceBooking.cshtml index 8b1e886..0b3f61c 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToConferenceBooking.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/AddDinnerToConferenceBooking.cshtml @@ -1,27 +1,76 @@ -@using HotelContracts.ViewModels; +@using HotelContracts.ViewModels; @using HotelDataModels.Models; @{ ViewData["Title"] = "AddDinnerToConferenceBooking"; } - -@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 diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/ListConferenceBookings.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/ListConferenceBookings.cshtml index 4fd9ae7..422b57c 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/ListConferenceBookings.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/ListConferenceBookings.cshtml @@ -84,7 +84,7 @@ asp-area="" asp-controller="Home" asp-action="AddDinnerToConferenceBooking" style="padding: 10 px" class="btn btn-outline-dark text-center d-flex justify-content-md-center" - >Добавить обед + >Добавить обеды
diff --git a/Hotel/HotelDataBaseImplement/HotelDataBase.cs b/Hotel/HotelDataBaseImplement/HotelDataBase.cs index 6d7ccea..5f56ccf 100644 --- a/Hotel/HotelDataBaseImplement/HotelDataBase.cs +++ b/Hotel/HotelDataBaseImplement/HotelDataBase.cs @@ -9,7 +9,7 @@ namespace HotelDataBaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-VG5USAH\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=HotelDataBaseFu;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs b/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs index 183dd92..e07d536 100644 --- a/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs +++ b/Hotel/HotelDataBaseImplement/Models/ConferenceBooking.cs @@ -59,7 +59,6 @@ namespace HotelDataBaseImplement.Models public void Update(ConferenceBookingBindingModel model) { ConferenceId = model.ConferenceId; - HeadwaiterId = model.HeadwaiterId; NameHall = model.NameHall; BookingDate = model.BookingDate; } @@ -86,7 +85,7 @@ namespace HotelDataBaseImplement.Models foreach (var updateDinner in conferenceBookingDinners) { - model.ConferenceBookingDinners.Remove(updateDinner.Id); + model.ConferenceBookingDinners.Remove(updateDinner.DinnerId); } context.SaveChanges(); }