30 lines
966 B
C#
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));
|
|
}
|
|
}
|
|
}
|