PIbd-21_BatylkinaAO_MusoevD.../Canteen/CanteenContracts/ViewModels/DishViewModel.cs
2023-05-18 00:40:11 +03:00

30 lines
966 B
C#

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<int, (IProductModel, int)> DishProducts { get; set; }
public DishViewModel() { }
[JsonConstructor]
public DishViewModel(Dictionary<int, (ProductViewModel, int)> DishProducts)
{
this.DishProducts = DishProducts.ToDictionary(x => x.Key, x => (x.Value.Item1 as IProductModel, x.Value.Item2));
}
}
}