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

43 lines
948 B
C#

using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.ViewModels;
using BeautySaloonDataModels;
namespace BeautySaloonDatabaseImplement;
/// <summary>
/// Сущность позиции
/// </summary>
public partial class Position : IPositionModel
{
/// <summary>
/// Идентификатор
/// </summary>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Name { get; set; } = null!;
public virtual ICollection<Employee> Employees { get; } = new List<Employee>();
public static Position Create(PositionBindingModel model)
{
return new Position()
{
Id = model.Id,
Name = model.Name
};
}
public void Update(PositionBindingModel model)
{
Name = model.Name;
}
public PositionViewModel GetViewModel => new()
{
Id = Id,
Name = Name
};
}