PIbd-23_Mochalov_D.V._LawFirm/LawFirm/LawFirmListImplements/Models/Blank.cs

53 lines
1.2 KiB
C#

using LawFirmContracts.BindingModels;
using LawFirmContracts.ViewModels;
using LawFirmDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LawFirmListImplements.Models
{
public class Blank : IBlankModel
{
public string BlankName { get; private set; } = String.Empty;
public double Cost { get; set; }
public int Id { get; private set; }
public static Blank? Create(BlankBindingModel? model)
{
if (model == null)
{
return null;
}
return new Blank()
{
Id = model.Id,
BlankName = model.BlankName,
Cost = model.Cost
};
}
public void Update(BlankBindingModel? model)
{
if (model == null)
{
return;
}
BlankName = model.BlankName;
Cost = model.Cost;
}
public BlankViewModel GetViewModel => new()
{
Id = Id,
BlankName = BlankName,
Cost = Cost
};
}
}