62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
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<int, (IWorkModel, int)> StoreWorks { 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,
|
|
StoreWorks = new()
|
|
};
|
|
}
|
|
|
|
public void Update(StoreBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return;
|
|
}
|
|
StoreName = model.StoreName;
|
|
StoreAdress = model.StoreAdress;
|
|
OpeningDate = model.OpeningDate;
|
|
StoreWorks = model.StoreWorks;
|
|
}
|
|
|
|
public StoreViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
StoreName = StoreName,
|
|
StoreAdress = StoreAdress,
|
|
OpeningDate = OpeningDate,
|
|
StoreWorks = StoreWorks
|
|
};
|
|
public int WorkMaxCount => throw new NotImplementedException();
|
|
}
|
|
}
|