using FurnitureAssemblyDataModels.Models; using FurnitureAssemblyContracts.BindingModels; using FurnitureAssemblyContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FurnitureAssemblyListImplement.Models { public class Furniture : IFurnitureModel { public int Id { get; private set; } public string FurnitureName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary FurnitureComponents { get; private set; } = new Dictionary(); public static Furniture? Create(FurnitureBindingModel? model) { if (model == null) { return null; } return new Furniture() { Id = model.Id, FurnitureName = model.FurnitureName, Price = model.Price, FurnitureComponents = model.FurnitureComponents }; } public void Update(FurnitureBindingModel? model) { if (model == null) { return; } FurnitureName = model.FurnitureName; Price = model.Price; FurnitureComponents = model.FurnitureComponents; } public FurnitureViewModel GetViewModel => new() { Id = Id, FurnitureName = FurnitureName, Price = Price, FurnitureComponents = FurnitureComponents }; } }