PIbd-22-Stroev-V.M.-Plumbin.../PlumbingRepair/PlumbingRepairListImplement/Models/Store.cs

62 lines
1.8 KiB
C#
Raw Permalink Normal View History

2024-05-05 00:19:00 +04:00
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; }
2024-05-05 21:39:31 +04:00
public Dictionary<int, (IWorkModel, int)> StoreWorks { get; private set; } = new();
2024-05-05 00:19:00 +04:00
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,
2024-05-05 21:39:31 +04:00
StoreWorks = new()
2024-05-05 00:19:00 +04:00
};
}
public void Update(StoreBindingModel? model)
{
if (model == null)
{
return;
}
StoreName = model.StoreName;
StoreAdress = model.StoreAdress;
OpeningDate = model.OpeningDate;
2024-05-05 21:39:31 +04:00
StoreWorks = model.StoreWorks;
2024-05-05 00:19:00 +04:00
}
public StoreViewModel GetViewModel => new()
{
Id = Id,
StoreName = StoreName,
StoreAdress = StoreAdress,
OpeningDate = OpeningDate,
2024-05-05 21:39:31 +04:00
StoreWorks = StoreWorks
2024-05-05 00:19:00 +04:00
};
2024-05-05 21:39:31 +04:00
public int WorkMaxCount => throw new NotImplementedException();
2024-05-05 00:19:00 +04:00
}
}