Делаем десираилазцию данных
This commit is contained in:
parent
e7701b5284
commit
a9d47cecc1
@ -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
|
||||
|
@ -6,6 +6,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HotelDataModels\HotelDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -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<int, ILunchModel> ConferenceBookingLunches { get; set; }
|
||||
|
||||
public Dictionary<int, IConferenceBookingModel> ConferenceConferenceBookings { get; set; } = new();
|
||||
public ConferenceBookingViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public ConferenceBookingViewModel(Dictionary<int, LunchViewModel> ConferenceBookingDinners, Dictionary<int, ConferenceBookingViewModel> 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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<int, ILunchModel> RoomLunches { get; set; }
|
||||
|
||||
public RoomViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public RoomViewModel(Dictionary<int, LunchViewModel> RoomDinners)
|
||||
{
|
||||
this.RoomLunches = RoomDinners.ToDictionary(x => x.Key, x => x.Value as ILunchModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user