using PlumbingRepairContracts.BindingModels; using PlumbingRepairContracts.ViewModels; using PlumbingRepairDataModels.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PlumbingRepairListImplement.Models { public class Store : IStoreModel { public string StoreName { get; private set; } = string.Empty; public string StoreAdress { get; private set; } = string.Empty; public DateTime OpeningDate { get; private set; } public Dictionary Works { get; private set; } = new(); public int Id { get; private set; } public static Store? Create(StoreBindingModel? model) { if (model == null) { return null; } return new Store() { Id = model.Id, StoreName = model.StoreName, StoreAdress = model.StoreAdress, OpeningDate = model.OpeningDate, Works = new() }; } public void Update(StoreBindingModel? model) { if (model == null) { return; } StoreName = model.StoreName; StoreAdress = model.StoreAdress; OpeningDate = model.OpeningDate; Works = model.Works; } public StoreViewModel GetViewModel => new() { Id = Id, StoreName = StoreName, StoreAdress = StoreAdress, OpeningDate = OpeningDate, Works = Works }; } }