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

31 lines
1007 B
C#

using CanteenDataModels.Enums;
using CanteenDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace CanteenContracts.View
{
public class OrderViewModel : IOrderModel
{
[DisplayName("ID посетителя")]
public int VisitorId { get; set; }
[DisplayName("Описание")]
public string Description { get; set; } = string.Empty;
public Dictionary<int, ICookModel> OrderCooks { get; set; }
public Dictionary<int, (ITablewareModel, int)> OrderTablewares { get; set; }
[DisplayName("ID заказа")]
public int Id { get; set; }
public OrderViewModel() { }
[JsonConstructor]
public OrderViewModel(Dictionary<int, CookViewModel> OrderCooks)
{
this.OrderCooks = OrderCooks.ToDictionary(x => x.Key, x => x.Value as ICookModel);
}
}
}