38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using HotelDataModels.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Newtonsoft.Json;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HotelContracts.ViewModels
|
|
{
|
|
public class MealPlanViewModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[DisplayName("Название плана питания")]
|
|
public string MealPlanName { get; set; } = string.Empty;
|
|
|
|
[DisplayName("Цена плана питания")]
|
|
public double MealPlanPrice { get; set; }
|
|
|
|
public int OrganiserId { get; set; }
|
|
|
|
public Dictionary<int, IParticipantModel> MealPlanParticipants { get; set; } = new();
|
|
public MealPlanViewModel()
|
|
{
|
|
MealPlanParticipants = new Dictionary<int, IParticipantModel>();
|
|
}
|
|
|
|
[JsonConstructor]
|
|
public MealPlanViewModel(Dictionary<int, ParticipantViewModel> MealPlanParticipants)
|
|
{
|
|
this.MealPlanParticipants = MealPlanParticipants?.ToDictionary(x => x.Key, x => x.Value as IParticipantModel)
|
|
?? new Dictionary<int, IParticipantModel>();
|
|
}
|
|
}
|
|
}
|