using LawFirmContracts.BindingModels; using LawFirmContracts.ViewModels; using LawFirmDataModels.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LawFirmListImplements.Models { public class Document : IDocumentModel { public string DocumentName { get; private set; } = string.Empty; public double Price { get; private set; } public Dictionary DocumentBlanks { get; private set; } = new Dictionary(); public int Id { get; private set; } public static Document? Create(DocumentBindingModel? model) { if (model == null) { return null; } return new Document() { Id = model.Id, DocumentName = model.DocumentName, Price = model.Price, DocumentBlanks = model.DocumentBlanks }; } public void Update(DocumentBindingModel? model) { if (model == null) { return; } DocumentName = model.DocumentName; Price = model.Price; DocumentBlanks = model.DocumentBlanks; } public DocumentViewModel GetViewModel => new() { Id = Id, DocumentName = DocumentName, Price = Price, DocumentBlanks = DocumentBlanks }; } }