PIbd-22_Chernyshev_Shabunov.../ComputerShopContracts/ViewModels/ShipmentViewModel.cs

39 lines
924 B
C#

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<int, IOrderModel> 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<int, OrderViewModel> shipmentOrders)
{
this.ShipmentOrders = shipmentOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel);
}
}
}