SUBD_PIbd-21_Balberova_D.N./BeautySaloon/BeautySaloonDatabaseImplement/Models/Order.cs

39 lines
1.2 KiB
C#
Raw Normal View History

using BeautySaloonDataModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BeautySaloonDatabaseImplement.Models
{
public class Order : IOrderModel
{
public int Id { get; set; }
[Required]
public DateTime Date { get; set; }
[Required]
public double Sum { get; set; }
[Required]
public int ClientId { get; set; }
[Required]
public int EmployeeId { get; set; }
private Dictionary<int, (DateTime, IServiceModel, IEmployeeModel)>? _orderServices = null;
[ForeignKey("OrderId")]
public virtual List<ServiceOrder> Services { get; set; } = new();
[NotMapped]
public Dictionary<int, (DateTime, IServiceModel, IEmployeeModel)> OrderServices
{
get
{
/*if (_orderServices == null)
{
_orderServices = Services
.ToDictionary(recPC => recPC.ServiceId,
recPC => (recPC.Service as IServiceModel, recPC.Count));
}*/
return _orderServices;
}
}
}
}