From 8c5732ed63b5f5e20c93bb1503b72f3f2466f93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Tue, 16 May 2023 18:11:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=B4?= =?UTF-8?q?=D0=B5=D0=B7=D0=B8=D0=B3=D0=BD=20=D0=B8=20=D0=B8=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E=20=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=87=D0=B8=D0=B9=20crud=20=D0=B4=D0=BB=D1=8F=20Dinner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Home/CreateDinner.cshtml | 30 ++++++ .../Views/Home/DeleteDinner.cshtml | 18 ++++ .../Views/Home/Enter.cshtml | 46 ++++---- .../Views/Home/Index.cshtml | 80 +++++++------- .../Views/Home/ListDinners.cshtml | 80 ++++++++++++++ .../Views/Home/ListOfMealPlans.cshtml | 25 ----- .../Views/Home/Register.cshtml | 101 +++++++++--------- .../Views/Home/UpdateDinner.cshtml | 71 ++++++++++++ .../Views/Shared/_Layout.cshtml | 2 +- .../HostrelHeadwaiterApp/wwwroot/css/site.css | 3 +- .../Implemets/ConferenceBookingStorage.cs | 14 +-- .../Implemets/DinnerStorage.cs | 41 +++---- .../Implemets/RoomStorage.cs | 8 +- Hotel/HotelDataBaseImplement/Models/Dinner.cs | 6 +- 14 files changed, 361 insertions(+), 164 deletions(-) create mode 100644 Hotel/HostrelHeadwaiterApp/Views/Home/CreateDinner.cshtml create mode 100644 Hotel/HostrelHeadwaiterApp/Views/Home/DeleteDinner.cshtml create mode 100644 Hotel/HostrelHeadwaiterApp/Views/Home/ListDinners.cshtml delete mode 100644 Hotel/HostrelHeadwaiterApp/Views/Home/ListOfMealPlans.cshtml create mode 100644 Hotel/HostrelHeadwaiterApp/Views/Home/UpdateDinner.cshtml diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/CreateDinner.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/CreateDinner.cshtml new file mode 100644 index 0000000..70f3f21 --- /dev/null +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/CreateDinner.cshtml @@ -0,0 +1,30 @@ +@{ + ViewData["Title"] = "CreateMember"; +} + +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
\ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/DeleteDinner.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/DeleteDinner.cshtml new file mode 100644 index 0000000..60f1e29 --- /dev/null +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/DeleteDinner.cshtml @@ -0,0 +1,18 @@ +@{ + ViewData["Title"] = "DeleteDinner"; +} + +
+
+
+
+ + +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/Enter.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/Enter.cshtml index d8a81bd..941c24f 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/Enter.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/Enter.cshtml @@ -12,24 +12,30 @@
-
- - -
-
- - -
-
-
-
-
+
+
+
+ + +
+
+ + +
+
+
+ +
+
+
\ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/Index.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/Index.cshtml index a85a072..3f4207d 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/Index.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/Index.cshtml @@ -7,44 +7,52 @@ ViewData["Title"] = "Home Page"; } + - + + Bootstrap Card + + -
-
-
-
-
-
-
-

- Гостиница -

-
-
-
-
- -
-
-
+ +
+
+
+
+
+
Отель
+
+
+

Создатель Кашин Максим и Жимолостнова Анна

-
\ No newline at end of file + + + + \ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/ListDinners.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/ListDinners.cshtml new file mode 100644 index 0000000..fe0077e --- /dev/null +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/ListDinners.cshtml @@ -0,0 +1,80 @@ +@using HotelContracts.ViewModels + +@model List + +@{ + ViewData["Title"] = "ListDinners"; +} + +
+
+
+
+
+
+
+
+ + + + + + + + + + @foreach (var item in Model){ + + + + + + } + +
+ Номер + + Цена обеда + + Название обеда +
+ @Html.DisplayFor(modelItem => item.Id) + + @Html.DisplayFor(modelItem => item.DinnerPrice) + + @Html.DisplayFor(modelItem => item.DinnerName) +
+
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/ListOfMealPlans.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/ListOfMealPlans.cshtml deleted file mode 100644 index 708c12c..0000000 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/ListOfMealPlans.cshtml +++ /dev/null @@ -1,25 +0,0 @@ - -@{ - ViewData["Title"] = "ListOfMealPlans"; -} - -
-

Заказы

-
- - -
-
- - -
- - - -
\ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/Register.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/Register.cshtml index e3e4879..9049d32 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Home/Register.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/Register.cshtml @@ -1,56 +1,61 @@ @{ ViewData["Title"] = "Register"; } - - -

Регистрация

-
- - -
- -
- - -
-
- - -
-
- - -
-
-
-
-
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
\ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Home/UpdateDinner.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Home/UpdateDinner.cshtml new file mode 100644 index 0000000..cfef88c --- /dev/null +++ b/Hotel/HostrelHeadwaiterApp/Views/Home/UpdateDinner.cshtml @@ -0,0 +1,71 @@ +@using HotelContracts.ViewModels; +@using HotelDataModels.Models; + +@{ + ViewData["Title"] = "UpdateDinner"; +} + + + + + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+ + +@section Scripts + { + +} \ No newline at end of file diff --git a/Hotel/HostrelHeadwaiterApp/Views/Shared/_Layout.cshtml b/Hotel/HostrelHeadwaiterApp/Views/Shared/_Layout.cshtml index 25f488c..fae9055 100644 --- a/Hotel/HostrelHeadwaiterApp/Views/Shared/_Layout.cshtml +++ b/Hotel/HostrelHeadwaiterApp/Views/Shared/_Layout.cshtml @@ -27,7 +27,7 @@ Главное меню - Обед + Обеды Комната diff --git a/Hotel/HostrelHeadwaiterApp/wwwroot/css/site.css b/Hotel/HostrelHeadwaiterApp/wwwroot/css/site.css index f27e5ad..44a431c 100644 --- a/Hotel/HostrelHeadwaiterApp/wwwroot/css/site.css +++ b/Hotel/HostrelHeadwaiterApp/wwwroot/css/site.css @@ -15,4 +15,5 @@ html { body { margin-bottom: 60px; -} \ No newline at end of file +} + diff --git a/Hotel/HotelDataBaseImplement/Implemets/ConferenceBookingStorage.cs b/Hotel/HotelDataBaseImplement/Implemets/ConferenceBookingStorage.cs index 5eb3011..4529d97 100644 --- a/Hotel/HotelDataBaseImplement/Implemets/ConferenceBookingStorage.cs +++ b/Hotel/HotelDataBaseImplement/Implemets/ConferenceBookingStorage.cs @@ -44,7 +44,7 @@ namespace HotelDataBaseImplement.Implemets return context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) @@ -65,7 +65,7 @@ namespace HotelDataBaseImplement.Implemets return context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) @@ -77,7 +77,7 @@ namespace HotelDataBaseImplement.Implemets return context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) @@ -88,7 +88,7 @@ namespace HotelDataBaseImplement.Implemets return context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) @@ -104,7 +104,7 @@ namespace HotelDataBaseImplement.Implemets return context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) @@ -128,7 +128,7 @@ namespace HotelDataBaseImplement.Implemets return context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) @@ -144,7 +144,7 @@ namespace HotelDataBaseImplement.Implemets var conferenceBooking = context.ConferenceBookings .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.RoomDinners) + .ThenInclude(x => x.RoomDinner) .ThenInclude(x => x.Room) .Include(x => x.Conference) .Include(x => x.Headwaiter) diff --git a/Hotel/HotelDataBaseImplement/Implemets/DinnerStorage.cs b/Hotel/HotelDataBaseImplement/Implemets/DinnerStorage.cs index ac92384..e1ea424 100644 --- a/Hotel/HotelDataBaseImplement/Implemets/DinnerStorage.cs +++ b/Hotel/HotelDataBaseImplement/Implemets/DinnerStorage.cs @@ -41,9 +41,9 @@ namespace HotelDataBaseImplement.Implemets using var context = new HotelDataBase(); return context.Dinners - .Include(x => x.RoomDinners) + .Include(x => x.RoomDinner) .ThenInclude(x => x.Room) - .Include(x => x.ConferenceBookingDinners) + .Include(x => x.ConferenceBookingDinner) .ThenInclude(x => x.ConferenceBooking) .FirstOrDefault(x => (!string.IsNullOrEmpty(model.DinnerName) && x.DinnerName == model.DinnerName) || (model.Id.HasValue && x.Id == model.Id))? .GetViewModel; @@ -61,21 +61,23 @@ namespace HotelDataBaseImplement.Implemets if (model.HeadwaiterId.HasValue) { return context.Dinners - .Include(x => x.RoomDinners) - .ThenInclude(x => x.Room) - .Include(x => x.ConferenceBookingDinners) - .ThenInclude(x => x.ConferenceBooking) - .Where(x => x.DinnerName.Contains(model.DinnerName)) - .ToList() - .Select(x => x.GetViewModel) - .ToList(); + .Include(x => x.RoomDinner) + .ThenInclude(x => x.Room) + .Include(x => x.ConferenceBookingDinner) + .ThenInclude(x => x.ConferenceBooking) + .Include(x => x.Headwaiter) + .Where(x => x.HeadwaiterId == model.HeadwaiterId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); } return context.Dinners - .Include(x => x.RoomDinners) + .Include(x => x.RoomDinner) .ThenInclude(x => x.Room) - .Include(x => x.ConferenceBookingDinners) + .Include(x => x.ConferenceBookingDinner) .ThenInclude(x => x.ConferenceBooking) + .Include(x => x.Headwaiter) .Where(x => x.DinnerName.Contains(model.DinnerName)) .ToList() .Select(x => x.GetViewModel) @@ -87,13 +89,14 @@ namespace HotelDataBaseImplement.Implemets using var context = new HotelDataBase(); return context.Dinners - .Include(x => x.RoomDinners) - .ThenInclude(x => x.Room) - .Include(x => x.ConferenceBookingDinners) - .ThenInclude(x => x.ConferenceBooking) - .ToList() - .Select(x => x.GetViewModel) - .ToList(); + .Include(x => x.RoomDinner) + .ThenInclude(x => x.Room) + .Include(x => x.ConferenceBookingDinner) + .ThenInclude(x => x.ConferenceBooking) + .Include(x => x.Headwaiter) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); } public DinnerViewModel? Insert(DinnerBindingModel model) diff --git a/Hotel/HotelDataBaseImplement/Implemets/RoomStorage.cs b/Hotel/HotelDataBaseImplement/Implemets/RoomStorage.cs index f6944de..2421e6a 100644 --- a/Hotel/HotelDataBaseImplement/Implemets/RoomStorage.cs +++ b/Hotel/HotelDataBaseImplement/Implemets/RoomStorage.cs @@ -46,7 +46,7 @@ namespace HotelDataBaseImplement.Implemets return context.Rooms .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.ConferenceBookingDinners) + .ThenInclude(x => x.ConferenceBookingDinner) .ThenInclude(x => x.ConferenceBooking) .Include(x => x.MealPlan) .Include(x => x.Headwaiter) @@ -57,7 +57,7 @@ namespace HotelDataBaseImplement.Implemets return context.Rooms .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.ConferenceBookingDinners) + .ThenInclude(x => x.ConferenceBookingDinner) .ThenInclude(x => x.ConferenceBooking) .Include(x => x.MealPlan) .Include(x => x.Headwaiter) @@ -77,7 +77,7 @@ namespace HotelDataBaseImplement.Implemets return context.Rooms .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.ConferenceBookingDinners) + .ThenInclude(x => x.ConferenceBookingDinner) .ThenInclude(x => x.ConferenceBooking) .Include(x => x.MealPlan) .Include(x => x.Headwaiter) @@ -92,7 +92,7 @@ namespace HotelDataBaseImplement.Implemets return context.Rooms .Include(x => x.Dinners) .ThenInclude(x => x.Dinner) - .ThenInclude(x => x.ConferenceBookingDinners) + .ThenInclude(x => x.ConferenceBookingDinner) .ThenInclude(x => x.ConferenceBooking) .Include(x => x.MealPlan) .Include(x => x.Headwaiter) diff --git a/Hotel/HotelDataBaseImplement/Models/Dinner.cs b/Hotel/HotelDataBaseImplement/Models/Dinner.cs index 1786813..b100aba 100644 --- a/Hotel/HotelDataBaseImplement/Models/Dinner.cs +++ b/Hotel/HotelDataBaseImplement/Models/Dinner.cs @@ -22,13 +22,13 @@ namespace HotelDataBaseImplement.Models [Required] public double DinnerPrice { get; set; } - public virtual Headwaiter Headwaiters { get; set; } + public virtual Headwaiter Headwaiter { get; set; } [ForeignKey("DinnerId")] - public virtual List RoomDinners { get; set; } + public virtual List RoomDinner { get; set; } [ForeignKey("DinnercId")] - public virtual List ConferenceBookingDinners { get; set; } + public virtual List ConferenceBookingDinner { get; set; } public static Dinner? Create(DinnerBindingModel model) { if (model == null)