45 lines
738 B
C#
Raw Normal View History

2024-07-23 21:32:13 +04:00

2024-07-24 13:22:05 +04:00
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
2024-07-23 21:32:13 +04:00
namespace BeautySalonDatabaseImplement.Models
{
public class Cosmetic
{
public int Id { get; set; }
public string? Name { get; set; }
public double Price { get; set; }
2024-07-24 13:22:05 +04:00
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
};
2024-07-23 21:32:13 +04:00
}
}