51 lines
1.4 KiB
C#
Raw Normal View History

2024-02-28 17:12:10 +04:00
using SushiBarContracts.BindingModels;
using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
namespace SushiBarListImplement.Models
{
public class Shop : IShopModel
{
public int Id { get; set; }
public string ShopName { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public DateTime DateCreate { get; private set; }
public Dictionary<int, (ISushiModel, int)> ShopShoshi
{
get;
private set;
} = new Dictionary<int, (ISushiModel, int)>();
public static Shop? Create(ShopBindingModel? model)
{
if (model == null)
{
return null;
}
return new Shop()
{
Id = model.Id,
ShopName = model.ShopName,
Address = model.Address,
DateCreate = model.DateCreate
};
}
public void Update(ShopBindingModel? model)
{
if (model == null)
{
return;
}
ShopName = model.ShopName;
Address = model.Address;
DateCreate = model.DateCreate;
}
public ShopViewModel GetViewModel => new()
{
Id = Id,
ShopName = ShopName,
Address = Address,
DateCreate = DateCreate
};
}
}