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; }
|
2023-03-29 22:56:00 +04:00
|
|
|
|
public virtual ICollection<ServiceOrder> ServiceOrders { get; } = new List<ServiceOrder>();
|
2023-03-28 21:24:52 +04:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
}
|