2023-04-06 14:34:58 +04:00
|
|
|
|
using CanteenDataModels.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2023-05-17 17:02:26 +04:00
|
|
|
|
using Newtonsoft.Json;
|
2023-04-06 14:34:58 +04:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace CanteenContracts.View
|
|
|
|
|
{
|
|
|
|
|
public class ProductViewModel : IProductModel
|
|
|
|
|
{
|
2023-05-17 17:02:26 +04:00
|
|
|
|
public int Id { get; set; }
|
2023-04-06 14:34:58 +04:00
|
|
|
|
[DisplayName("Название продукта")]
|
|
|
|
|
public string ProductName { get; set; } = string.Empty;
|
2023-04-07 21:53:52 +04:00
|
|
|
|
|
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; }
|
|
|
|
|
|
2023-05-20 00:18:48 +04:00
|
|
|
|
public Dictionary<int, ICookModel> ProductCooks { get; set; }
|
2023-04-07 21:53:52 +04:00
|
|
|
|
|
2023-05-17 17:02:26 +04:00
|
|
|
|
public ProductViewModel() { }
|
|
|
|
|
[JsonConstructor]
|
|
|
|
|
public ProductViewModel(Dictionary<int, CookViewModel> ProductCooks)
|
|
|
|
|
{
|
|
|
|
|
this.ProductCooks = ProductCooks.ToDictionary(x => x.Key, x => x.Value as ICookModel);
|
|
|
|
|
}
|
2023-04-06 14:34:58 +04:00
|
|
|
|
}
|
2023-04-07 21:53:52 +04:00
|
|
|
|
|
2023-04-06 14:34:58 +04:00
|
|
|
|
}
|