using AbstractLawFirmContracts.BindingModels; using AbstractLawFirmContracts.ViewModels; using AbstractLawFirmDataModels.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AbstractLawFirmListImplement.Models { public class Shop : IShopModel { public int Id { get; private set; } public string ShopName { get; private set; } = string.Empty; public string Address { get; private set; } = string.Empty; public int MaxCountDocuments { get; private set; } public DateTime OpeningDate { get; private set; } public Dictionary ShopDocuments { get; private set; } = new Dictionary(); public static Shop? Create(ShopBindingModel? model) { if (model == null) { return null; } return new Shop() { Id = model.Id, ShopName = model.ShopName, Address = model.Address, OpeningDate = model.OpeningDate, ShopDocuments = model.ShopDocuments }; } public void Update(ShopBindingModel? model) { if (model == null) { return; } ShopName = model.ShopName; Address = model.Address; OpeningDate = model.OpeningDate; ShopDocuments = model.ShopDocuments; } public ShopViewModel GetViewModel => new() { Id = Id, ShopName = ShopName, Address = Address, OpeningDate = OpeningDate, ShopDocuments = ShopDocuments }; } }