From a9d47cecc1412c6cde10fa9a2e2f03008d651937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D1=8F=D1=87=D0=B5=D1=81=D0=BB=D0=B0=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 23 Mar 2024 18:43:34 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B5=D0=BB=D0=B0=D0=B5=D0=BC=20=D0=B4?= =?UTF-8?q?=D0=B5=D1=81=D0=B8=D1=80=D0=B0=D0=B8=D0=BB=D0=B0=D0=B7=D1=86?= =?UTF-8?q?=D0=B8=D1=8E=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hotel/Hotel.sln | 8 ++++---- Hotel/HotelContracts/HotelContracts.csproj | 4 ++++ .../ViewModels/ConferenceBookingViewModel.cs | 11 +++++++++++ Hotel/HotelContracts/ViewModels/RoomViewModel.cs | 9 +++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Hotel/Hotel.sln b/Hotel/Hotel.sln index de113fe..5156ed3 100644 --- a/Hotel/Hotel.sln +++ b/Hotel/Hotel.sln @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34622.214 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelView", "HotelView\HotelView.csproj", "{6178B3A4-FD96-4706-BA98-85A1B348544F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelView", "HotelView\HotelView.csproj", "{6178B3A4-FD96-4706-BA98-85A1B348544F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelDataModels", "HotelDataModels\HotelDataModels.csproj", "{CA43CA92-EB41-4E16-AE45-8D6E72819F8C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelDataModels", "HotelDataModels\HotelDataModels.csproj", "{CA43CA92-EB41-4E16-AE45-8D6E72819F8C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelContracts", "HotelContracts\HotelContracts.csproj", "{BF2AB478-A809-4A22-AA0A-A655BC9628B8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelContracts", "HotelContracts\HotelContracts.csproj", "{BF2AB478-A809-4A22-AA0A-A655BC9628B8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelDataBaseImplement", "HotelDataBaseImplement\HotelDataBaseImplement.csproj", "{3FAD978F-2155-4D65-963D-616F18ABA37F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HotelDataBaseImplement", "HotelDataBaseImplement\HotelDataBaseImplement.csproj", "{3FAD978F-2155-4D65-963D-616F18ABA37F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Hotel/HotelContracts/HotelContracts.csproj b/Hotel/HotelContracts/HotelContracts.csproj index 47b3b16..a9f6023 100644 --- a/Hotel/HotelContracts/HotelContracts.csproj +++ b/Hotel/HotelContracts/HotelContracts.csproj @@ -6,6 +6,10 @@ enable + + + + diff --git a/Hotel/HotelContracts/ViewModels/ConferenceBookingViewModel.cs b/Hotel/HotelContracts/ViewModels/ConferenceBookingViewModel.cs index f63e473..865853d 100644 --- a/Hotel/HotelContracts/ViewModels/ConferenceBookingViewModel.cs +++ b/Hotel/HotelContracts/ViewModels/ConferenceBookingViewModel.cs @@ -1,4 +1,5 @@ using HotelDataModels.Models; +using Newtonsoft.Json; using System.ComponentModel; namespace HotelContracts.ViewModels @@ -16,5 +17,15 @@ namespace HotelContracts.ViewModels public string NameHall { get; set; } = string.Empty; public Dictionary ConferenceBookingLunches { get; set; } + + public Dictionary ConferenceConferenceBookings { get; set; } = new(); + public ConferenceBookingViewModel() { } + + [JsonConstructor] + public ConferenceBookingViewModel(Dictionary ConferenceBookingDinners, Dictionary ConferenceConferenceBookings) + { + this.ConferenceBookingLunches = ConferenceBookingDinners.ToDictionary(x => x.Key, x => x.Value as ILunchModel); + this.ConferenceConferenceBookings = ConferenceConferenceBookings.ToDictionary(x => x.Key, x => x.Value as IConferenceBookingModel); + } } } \ No newline at end of file diff --git a/Hotel/HotelContracts/ViewModels/RoomViewModel.cs b/Hotel/HotelContracts/ViewModels/RoomViewModel.cs index 3df4455..b3f314f 100644 --- a/Hotel/HotelContracts/ViewModels/RoomViewModel.cs +++ b/Hotel/HotelContracts/ViewModels/RoomViewModel.cs @@ -1,4 +1,5 @@ using HotelDataModels.Models; +using Newtonsoft.Json; using System.ComponentModel; namespace HotelContracts.ViewModels @@ -21,5 +22,13 @@ namespace HotelContracts.ViewModels public int HeadwaiterId { get; set; } public Dictionary RoomLunches { get; set; } + + public RoomViewModel() { } + + [JsonConstructor] + public RoomViewModel(Dictionary RoomDinners) + { + this.RoomLunches = RoomDinners.ToDictionary(x => x.Key, x => x.Value as ILunchModel); + } } }