PIbd-21_Markov_D.P._LawFirm/LawFirm/LawFirmListImplement/Models/Blank.cs

42 lines
1.1 KiB
C#
Raw Normal View History

2023-02-13 22:22:24 +04:00
using LawFirmDataModels.Models;
using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
namespace LawFirmListImplement.Models
{
public class Blank : IBlankModel
{
public int Id { get; private set; }
public string BlankName { get; private set; } = string.Empty;
public double Price { get; set; }
public static Blank? Create(BlankBindingModel? model)
{
if (model == null)
{
return null;
}
return new Blank()
{
Id = model.Id,
BlankName = model.BlankName,
Price = model.Price
};
}
public void Update(BlankBindingModel? model)
{
if (model == null)
{
return;
}
BlankName = model.BlankName;
Price = model.Price;
}
public BlankViewModel GetViewModel => new()
{
Id = Id,
BlankName = BlankName,
Price = Price
};
}
}