32 lines
928 B
C#
32 lines
928 B
C#
using ComputerStoreDataModels.Models;
|
|
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();
|
|
|
|
[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() { }
|
|
}
|
|
}
|