35 lines
971 B
C#
35 lines
971 B
C#
using CanteenDataModels.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Newtonsoft.Json;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CanteenContracts.View
|
|
{
|
|
public class ProductViewModel : IProductModel
|
|
{
|
|
public int Id { get; set; }
|
|
[DisplayName("Название продукта")]
|
|
public string ProductName { get; set; } = string.Empty;
|
|
|
|
[DisplayName("Цена")]
|
|
public double Price { get; set; }
|
|
|
|
[DisplayName("ID менеджера")]
|
|
public int ManagerId { get; set; }
|
|
|
|
public Dictionary<int, ICookModel> ProductCooks { get; set; } = new();
|
|
|
|
public ProductViewModel() { }
|
|
[JsonConstructor]
|
|
public ProductViewModel(Dictionary<int, CookViewModel> ProductCooks)
|
|
{
|
|
this.ProductCooks = ProductCooks.ToDictionary(x => x.Key, x => x.Value as ICookModel);
|
|
}
|
|
}
|
|
|
|
}
|