using SewingDressesContracts.BindingModels; using SewingDressesContracts.ViewModels; using SewingDressesDataModels.Models; namespace SewingDressesListImplement.Models { public class Dress : IDressModel { public int Id { get; private set; } public string DressName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary DressComponents { get; private set; } = new Dictionary(); public static Dress? Create(DressBindingModel? model) { if (model == null) { return null; } return new Dress() { Id = model.Id, DressName = model.DressName, Price = model.Price, DressComponents = model.DressComponents }; } public void Update(DressBindingModel? model) { if (model == null) { return; } DressName = model.DressName; Price = model.Price; DressComponents = model.DressComponents; } public DressViewModel GetViewModel => new() { Id = Id, DressName = DressName, Price = Price, DressComponents = DressComponents }; } }