using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SushiBarListImplement.Models { internal class Sushi : IProductModel { public int Id { get; private set; } public string ProductName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary ProductComponents { get; private set; } = new Dictionary(); public static Product? Create(ProductBindingModel? model) { if (model == null) { return null; } return new Product() { Id = model.Id, ProductName = model.ProductName, Price = model.Price, ProductComponents = model.ProductComponents }; } public void Update(ProductBindingModel? model) { if (model == null) { return; } ProductName = model.ProductName; Price = model.Price; ProductComponents = model.ProductComponents; } public ProductViewModel GetViewModel => new() { Id = Id, ProductName = ProductName, Price = Price, ProductComponents = ProductComponents }; } }