using BeautySalonContracts.BindingModels; using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Models { public class Cosmetic { public int Id { get; set; } public string Name { get; set; } = string.Empty; public double Price { get; set; } public static Cosmetic? Create(CosmeticBindingModel model) { if (model == null) { return null; } return new Cosmetic { Id = model.Id, Name = model.Name, Price = model.Price }; } public void Update(CosmeticBindingModel model) { if (model == null) { return; } Name = model.Name; Price = model.Price; } public CosmeticViewModel GetViewModel => new() { Id = Id, Name = Name, Price = Price }; } }