53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
|
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
|
|||
|
};
|
|||
|
}
|