ListImplements

This commit is contained in:
VictoriaPresnyakova 2023-02-05 19:55:32 +04:00
parent fb52c67682
commit 92bee445c3
9 changed files with 149 additions and 7 deletions

View File

@ -1,7 +0,0 @@
namespace JewelryStoreListImplement
{
public class Class1
{
}
}

View 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;
}
}
}

View 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
{
}
}

View 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
{
}
}

View 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
{
}
}

View File

@ -6,4 +6,9 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JewelryStoreContracts\JewelryStoreContracts.csproj" />
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
</ItemGroup>
</Project> </Project>

View 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
{
}
}

View 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
};
}
}

View 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
{
}
}