2024-07-25 18:44:30 +04:00

45 lines
785 B
C#

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
internal class Cosmetic
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public double Price { get; private 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
};
}
}