SUBD_PIbd-21_Balberova_D.N./BeautySaloon/BeautySaloonDatabaseImplement/Service.cs

53 lines
1.1 KiB
C#
Raw Normal View History

2023-03-28 21:24:52 +04:00
using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.ViewModels;
using BeautySaloonDataModels;
using System;
using System.Collections.Generic;
namespace BeautySaloonDatabaseImplement;
/// <summary>
/// Сущность услуги
/// </summary>
public partial class Service : IServiceModel
{
/// <summary>
/// Уникальный идентификатор
/// </summary>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// Цена
/// </summary>
public decimal Price { get; set; }
public virtual ServiceOrder? ServiceOrder { get; set; }
public static Service Create(ServiceBindingModel model)
{
return new Service()
{
Id = model.Id,
Name = model.Name,
Price = model.Price
};
}
public void Update(ServiceBindingModel model)
{
Name = model.Name;
Price = model.Price;
}
public ServiceViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Price = Price
};
}