using FlowerShopDataModels.Models; using FlowerShopContracts.BindingModels; using FlowerShopContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FlowerShopListImplement.Models { public class Flower : IFlowerModel { public int Id { get; private set; } public string FlowerName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary FlowerComponents { get; private set; } = new Dictionary(); public static Flower? Create(FlowerBindingModel? model) { if (model == null) { return null; } return new Flower() { Id = model.Id, FlowerName = model.FlowerName, Price = model.Price, FlowerComponents = model.FlowerComponents }; } public void Update(FlowerBindingModel? model) { if (model == null) { return; } FlowerName = model.FlowerName; Price = model.Price; FlowerName = model.FlowerName; } public FlowerViewModel GetViewModel => new() { Id = Id, FlowerName = FlowerName, Price = Price, FlowerComponents = FlowerComponents }; } }