using ComputerShopDataModels.Models; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ComputerShopContracts.ViewModels { public class ShipmentViewModel : IShipmentModel { [DisplayName("Номер")] public int Id { get; set; } public int UserId { get; set; } public Dictionary ShipmentOrders { get; set; } = new(); [DisplayName("Поставщик")] public string ProviderName { get; set; } = string.Empty; [DisplayName("Дата поставки")] public DateTime DateShipment { get; set; } = DateTime.Now; public ShipmentViewModel() { } [JsonConstructor] public ShipmentViewModel(Dictionary shipmentOrders) { this.ShipmentOrders = shipmentOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel); } } }