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

38 lines
1.3 KiB
C#
Raw Normal View History

2023-04-07 21:53:52 +04:00
using CanteenDataModels.Enums;
using CanteenDataModels.Models;
2023-05-20 12:11:48 +04:00
using Newtonsoft.Json;
2023-04-06 14:34:58 +04:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanteenContracts.View
{
public class LunchViewModel : ILunchModel
{
public int Id { get; set; }
2023-04-07 21:53:52 +04:00
[DisplayName("ID посетителя")]
2023-04-06 14:34:58 +04:00
public int VisitorId { get; set; }
[DisplayName("Название обеда")]
public string LunchName { get; set; } = string.Empty;
2023-04-07 21:53:52 +04:00
[DisplayName("Сумма")]
public double Sum { get; set; }
[DisplayName("Статус")]
public LunchStatus Status { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
[DisplayName("Дата реализации")]
public DateTime? DateImplement { get; set; }
2023-05-20 00:18:48 +04:00
public Dictionary<int, (IProductModel, int)> LunchProducts { get; set; }
public Dictionary<int, IOrderModel> LunchOrders { get; set; }
2023-05-20 12:11:48 +04:00
public LunchViewModel() { }
[JsonConstructor]
public LunchViewModel(Dictionary<int, OrderViewModel> LunchOrders)
{
this.LunchOrders = LunchOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel);
}
2023-04-06 14:34:58 +04:00
}
}