using CanteenDataModels.Enums; using CanteenDataModels.Models; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CanteenContracts.View { public class LunchViewModel : ILunchModel { public int Id { get; set; } [DisplayName("ID посетителя")] public int VisitorId { get; set; } [DisplayName("Название обеда")] public string LunchName { get; set; } = string.Empty; [DisplayName("Сумма")] public double Sum { get; set; } [DisplayName("Статус")] public LunchStatus Status { get; set; } [DisplayName("Дата создания")] public DateTime DateCreate { get; set; } [DisplayName("Дата реализации")] public DateTime? DateImplement { get; set; } public Dictionary LunchProducts { get; set; } public Dictionary LunchOrders { get; set; } public LunchViewModel() { } [JsonConstructor] public LunchViewModel(Dictionary LunchOrders) { this.LunchOrders = LunchOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel); } } }