ListImplements
This commit is contained in:
parent
fb52c67682
commit
92bee445c3
@ -1,7 +0,0 @@
|
||||
namespace JewelryStoreListImplement
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
31
JewelryStoreListImplement/DataListSingleton.cs
Normal file
31
JewelryStoreListImplement/DataListSingleton.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using JewelryStoreListImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement
|
||||
{
|
||||
public class DataListSingleton
|
||||
{
|
||||
private static DataListSingleton? _instance;
|
||||
public List<Component> Components { get; set; }
|
||||
public List<Order> Orders { get; set; }
|
||||
public List<Jewel> Jewels { get; set; }
|
||||
private DataListSingleton()
|
||||
{
|
||||
Components = new List<Component>();
|
||||
Orders = new List<Order>();
|
||||
Jewels = new List<Jewel>();
|
||||
}
|
||||
public static DataListSingleton GetInstance()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new DataListSingleton();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
12
JewelryStoreListImplement/Implements/ComponentStorage .cs
Normal file
12
JewelryStoreListImplement/Implements/ComponentStorage .cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Implements
|
||||
{
|
||||
internal class ComponentStorage
|
||||
{
|
||||
}
|
||||
}
|
12
JewelryStoreListImplement/Implements/JewelStorage.cs
Normal file
12
JewelryStoreListImplement/Implements/JewelStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Implements
|
||||
{
|
||||
internal class JewelStorage
|
||||
{
|
||||
}
|
||||
}
|
12
JewelryStoreListImplement/Implements/OrderStorage.cs
Normal file
12
JewelryStoreListImplement/Implements/OrderStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Implements
|
||||
{
|
||||
internal class OrderStorage
|
||||
{
|
||||
}
|
||||
}
|
@ -6,4 +6,9 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\JewelryStoreContracts\JewelryStoreContracts.csproj" />
|
||||
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
12
JewelryStoreListImplement/Models/Component.cs
Normal file
12
JewelryStoreListImplement/Models/Component.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Models
|
||||
{
|
||||
internal class Component
|
||||
{
|
||||
}
|
||||
}
|
53
JewelryStoreListImplement/Models/Jewel.cs
Normal file
53
JewelryStoreListImplement/Models/Jewel.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Models
|
||||
{
|
||||
public class Jewel: IJewelModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string JewelName { get; private set; } = string.Empty;
|
||||
public double Price { get; private set; }
|
||||
public Dictionary<int, (IComponentModel, int)> JewelComponents
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new Dictionary<int, (IComponentModel, int)>();
|
||||
public static Jewel? Create(JewelBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Jewel()
|
||||
{
|
||||
Id = model.Id,
|
||||
JewelName = model.JewelName,
|
||||
Price = model.Price,
|
||||
JewelComponents = model.JewelComponents
|
||||
};
|
||||
}
|
||||
public void Update(JewelBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
JewelName = model.JewelName;
|
||||
Price = model.Price;
|
||||
JewelComponents = model.JewelComponents;
|
||||
}
|
||||
public JewelViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
JewelName = JewelName,
|
||||
Price = Price,
|
||||
JewelComponents = JewelComponents
|
||||
};
|
||||
|
||||
}
|
||||
}
|
12
JewelryStoreListImplement/Models/Order.cs
Normal file
12
JewelryStoreListImplement/Models/Order.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Models
|
||||
{
|
||||
internal class Order
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user