Coursework_ComputerStore_Li.../ComputerStoreContracts/BindingModels/PCBindingModel.cs

32 lines
928 B
C#
Raw Normal View History

using ComputerStoreDataModels.Models;
2023-05-17 17:57:25 +04:00
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreContracts.BindingModels
{
public class PCBindingModel : IPCModel
{
public int ID {get; set;}
public string Name { get; set; } = string.Empty;
public double Price { get; set; }
public int EmployeeID { get; set; }
public int RequestID { get; set; }
public Dictionary<int, (IComponentModel, int)> PCComponents { get; set; } = new();
2023-05-17 17:57:25 +04:00
[JsonConstructor]
public PCBindingModel(Dictionary<int, (ComponentBindingModel Component, int Quantity)> PCComponents)
{
this.PCComponents = PCComponents.ToDictionary(x => x.Key, x => (x.Value.Component as IComponentModel, x.Value.Quantity));
}
public PCBindingModel() { }
}
}