From 92bee445c3a0592a9f443d43627375ad7e35e42c Mon Sep 17 00:00:00 2001 From: VictoriaPresnyakova Date: Sun, 5 Feb 2023 19:55:32 +0400 Subject: [PATCH] ListImplements --- JewelryStoreListImplement/Class1.cs | 7 --- .../DataListSingleton.cs | 31 +++++++++++ .../Implements/ComponentStorage .cs | 12 +++++ .../Implements/JewelStorage.cs | 12 +++++ .../Implements/OrderStorage.cs | 12 +++++ .../JewelryStoreListImplement.csproj | 5 ++ JewelryStoreListImplement/Models/Component.cs | 12 +++++ JewelryStoreListImplement/Models/Jewel.cs | 53 +++++++++++++++++++ JewelryStoreListImplement/Models/Order.cs | 12 +++++ 9 files changed, 149 insertions(+), 7 deletions(-) delete mode 100644 JewelryStoreListImplement/Class1.cs create mode 100644 JewelryStoreListImplement/DataListSingleton.cs create mode 100644 JewelryStoreListImplement/Implements/ComponentStorage .cs create mode 100644 JewelryStoreListImplement/Implements/JewelStorage.cs create mode 100644 JewelryStoreListImplement/Implements/OrderStorage.cs create mode 100644 JewelryStoreListImplement/Models/Component.cs create mode 100644 JewelryStoreListImplement/Models/Jewel.cs create mode 100644 JewelryStoreListImplement/Models/Order.cs diff --git a/JewelryStoreListImplement/Class1.cs b/JewelryStoreListImplement/Class1.cs deleted file mode 100644 index cdbf310..0000000 --- a/JewelryStoreListImplement/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace JewelryStoreListImplement -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/JewelryStoreListImplement/DataListSingleton.cs b/JewelryStoreListImplement/DataListSingleton.cs new file mode 100644 index 0000000..1b280c4 --- /dev/null +++ b/JewelryStoreListImplement/DataListSingleton.cs @@ -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 Components { get; set; } + public List Orders { get; set; } + public List Jewels { get; set; } + private DataListSingleton() + { + Components = new List(); + Orders = new List(); + Jewels = new List(); + } + public static DataListSingleton GetInstance() + { + if (_instance == null) + { + _instance = new DataListSingleton(); + } + return _instance; + } + } +} diff --git a/JewelryStoreListImplement/Implements/ComponentStorage .cs b/JewelryStoreListImplement/Implements/ComponentStorage .cs new file mode 100644 index 0000000..aaffee8 --- /dev/null +++ b/JewelryStoreListImplement/Implements/ComponentStorage .cs @@ -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 + { + } +} diff --git a/JewelryStoreListImplement/Implements/JewelStorage.cs b/JewelryStoreListImplement/Implements/JewelStorage.cs new file mode 100644 index 0000000..57e8b90 --- /dev/null +++ b/JewelryStoreListImplement/Implements/JewelStorage.cs @@ -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 + { + } +} diff --git a/JewelryStoreListImplement/Implements/OrderStorage.cs b/JewelryStoreListImplement/Implements/OrderStorage.cs new file mode 100644 index 0000000..d13c73f --- /dev/null +++ b/JewelryStoreListImplement/Implements/OrderStorage.cs @@ -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 + { + } +} diff --git a/JewelryStoreListImplement/JewelryStoreListImplement.csproj b/JewelryStoreListImplement/JewelryStoreListImplement.csproj index 132c02c..783cc4d 100644 --- a/JewelryStoreListImplement/JewelryStoreListImplement.csproj +++ b/JewelryStoreListImplement/JewelryStoreListImplement.csproj @@ -6,4 +6,9 @@ enable + + + + + diff --git a/JewelryStoreListImplement/Models/Component.cs b/JewelryStoreListImplement/Models/Component.cs new file mode 100644 index 0000000..6ad51d8 --- /dev/null +++ b/JewelryStoreListImplement/Models/Component.cs @@ -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 + { + } +} diff --git a/JewelryStoreListImplement/Models/Jewel.cs b/JewelryStoreListImplement/Models/Jewel.cs new file mode 100644 index 0000000..11d77df --- /dev/null +++ b/JewelryStoreListImplement/Models/Jewel.cs @@ -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 JewelComponents + { + get; + private set; + } = new Dictionary(); + 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 + }; + + } +} diff --git a/JewelryStoreListImplement/Models/Order.cs b/JewelryStoreListImplement/Models/Order.cs new file mode 100644 index 0000000..d982fe3 --- /dev/null +++ b/JewelryStoreListImplement/Models/Order.cs @@ -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 + { + } +}