2024-02-23 18:38:04 +04:00
|
|
|
|
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;
|
2024-03-10 22:47:50 +04:00
|
|
|
|
public int MaxCountDocuments { get; private set; }
|
2024-02-23 18:38:04 +04:00
|
|
|
|
public DateTime OpeningDate { get; private set; }
|
|
|
|
|
public Dictionary<int, (IDocumentModel, int)> ShopDocuments
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
} = new Dictionary<int, (IDocumentModel, int)>();
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|