using PrecastConcretePlantContracts.BindingModels; using PrecastConcretePlantContracts.ViewModels; using PrecastConcretePlantDataModels.Models; namespace PrecastConcretePlantListImplement.Models { public class Reinforced : IReinforcedModel { public int Id { get; private set; } public string ReinforcedName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary ReinforcedComponents { get; private set; } = new Dictionary(); public static Reinforced? Create(ReinforcedBindingModel? model) { if (model == null) { return null; } return new Reinforced() { Id = model.Id, ReinforcedName = model.ReinforcedName, Price = model.Price, ReinforcedComponents = model.ReinforcedComponents }; } public void Update(ReinforcedBindingModel? model) { if (model == null) { return; } ReinforcedName = model.ReinforcedName; Price = model.Price; ReinforcedComponents = model.ReinforcedComponents; } public ReinforcedViewModel GetViewModel => new() { Id = Id, ReinforcedName = ReinforcedName, Price = Price, ReinforcedComponents = ReinforcedComponents }; } }