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 DishViewModel : IDishModel { [DisplayName("Название блюда")] public string DishName { get; set; } [DisplayName("Цена")] public double Price { get; set; } [DisplayName("ID менеджера")] public int ManagerId { get; set; } public int Id { get; set; } public Dictionary DishProducts { get; set; } public DishViewModel() { } [JsonConstructor] public DishViewModel(Dictionary DishProducts) { this.DishProducts = DishProducts.ToDictionary(x => x.Key, x => (x.Value.Item1 as IProductModel, x.Value.Item2)); } } }