PIbd-21_BatylkinaAO_MusoevD.../Canteen/CanteenContracts/ViewModels/DishViewModel.cs

30 lines
966 B
C#
Raw Permalink Normal View History

2023-04-06 14:34:58 +04:00
using CanteenDataModels.Models;
2023-05-18 01:40:11 +04:00
using Newtonsoft.Json;
2023-04-06 14:34:58 +04:00
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("Название блюда")]
2023-04-07 21:53:52 +04:00
public string DishName { get; set; }
2023-04-06 14:34:58 +04:00
[DisplayName("Цена")]
2023-04-07 21:53:52 +04:00
public double Price { get; set; }
[DisplayName("ID менеджера")]
public int ManagerId { get; set; }
public int Id { get; set; }
2023-04-09 00:34:25 +04:00
public Dictionary<int, (IProductModel, int)> DishProducts { get; set; }
2023-05-18 01:40:11 +04:00
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));
}
2023-04-06 14:34:58 +04:00
}
}