using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TypographyContracts.BindingModels; using TypographyContracts.ViewModels; using TypographyDataModels.Models; namespace TypographyListImplement.Models { public class Printed : IPrintedModel { public int Id { get; private set; } public string PrintedName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary PrintedComponents { get; private set; } = new Dictionary(); public static Printed? Create(PrintedBindingModel? model) { if (model == null) { return null; } return new Printed() { Id = model.Id, PrintedName = model.PrintedName, Price = model.Price, PrintedComponents = model.PrintedComponents }; } public void Update(PrintedBindingModel? model) { if (model == null) { return; } PrintedName = model.PrintedName; Price = model.Price; PrintedComponents = model.PrintedComponents; } public PrintedViewModel GetViewModel => new() { Id = Id, PrintedName = PrintedName, Price = Price, PrintedComponents = PrintedComponents }; } }