From 9fb4943f9b27446feb3fd7afaa7613dc175fcfa9 Mon Sep 17 00:00:00 2001 From: revengel66 Date: Wed, 24 Jul 2024 13:22:05 +0400 Subject: [PATCH] edit models --- .../BeautySalonBusinessLogic.csproj | 2 +- .../BeautySalonContracts.csproj | 7 --- .../StorageContracts/IClientStorage.cs | 15 +++--- .../StorageContracts/ICosmeticStorage.cs | 16 ++++--- .../StorageContracts/IDistributionStorage.cs | 16 ++++--- .../StorageContracts/IEmployeeStorage.cs | 15 +++--- .../StorageContracts/IProcedureStorage.cs | 16 ++++--- .../StorageContracts/IPurchaseStorage.cs | 16 ++++--- .../StorageContracts/IReceiptStorage.cs | 15 +++--- .../StorageContracts/IVisitStorage.cs | 15 +++--- .../ViewModels/PurchaseViewModel.cs | 2 +- ...csproj => BeautySalonListImplement.csproj} | 2 +- .../DataListSingleton.cs | 39 +++++++++++++++ .../Implements/ClientStorage.cs | 38 +++++++++++++-- .../Implements/CosmeticStorage.cs | 48 ++++++++++++++++--- .../Implements/DistributionStorage.cs | 37 ++++++++++++-- .../Implements/EmployeeStorage.cs | 37 ++++++++++++-- .../Implements/ProcedureStorage.cs | 37 ++++++++++++-- .../Implements/PurchaseStorage.cs | 37 ++++++++++++-- .../Implements/ReceiptStorage.cs | 37 ++++++++++++-- .../Implements/VisitStorage.cs | 38 +++++++++++++-- .../Models/Client.cs | 44 +++++++++++++++++ .../Models/Cosmetic.cs | 34 ++++++++++++- .../Models/Distribution.cs | 35 ++++++++++++++ .../Models/Employee.cs | 42 ++++++++++++++++ .../Models/Procedure.cs | 37 ++++++++++++++ .../Models/Purchase.cs | 34 ++++++++++++- .../Models/Receipt.cs | 32 +++++++++++++ .../Models/Visit.cs | 33 +++++++++++++ 29 files changed, 673 insertions(+), 103 deletions(-) rename BeautySalon/BeautySalonDatabaseImplement/{BeautySalonDatabaseImplement.csproj => BeautySalonListImplement.csproj} (73%) create mode 100644 BeautySalon/BeautySalonDatabaseImplement/DataListSingleton.cs diff --git a/BeautySalon/BeautySalonBusinessLogic/BeautySalonBusinessLogic.csproj b/BeautySalon/BeautySalonBusinessLogic/BeautySalonBusinessLogic.csproj index e6ee218..aaaa7e8 100644 --- a/BeautySalon/BeautySalonBusinessLogic/BeautySalonBusinessLogic.csproj +++ b/BeautySalon/BeautySalonBusinessLogic/BeautySalonBusinessLogic.csproj @@ -7,7 +7,7 @@ - + diff --git a/BeautySalon/BeautySalonContracts/BeautySalonContracts.csproj b/BeautySalon/BeautySalonContracts/BeautySalonContracts.csproj index 9775092..132c02c 100644 --- a/BeautySalon/BeautySalonContracts/BeautySalonContracts.csproj +++ b/BeautySalon/BeautySalonContracts/BeautySalonContracts.csproj @@ -6,11 +6,4 @@ enable - - - - - - - diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IClientStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IClientStorage.cs index f814582..1e32c9a 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IClientStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IClientStorage.cs @@ -1,12 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IClientStorage + public interface IClientStorage { + List GetFullList(); + List GetFilteredList(ClientBindingModel model); + ClientViewModel GetElement(ClientBindingModel model); + ClientViewModel Insert(ClientBindingModel model); + ClientViewModel Update(ClientBindingModel model); + ClientViewModel Deleted(ClientBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/ICosmeticStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/ICosmeticStorage.cs index 74aa9f9..5e84853 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/ICosmeticStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/ICosmeticStorage.cs @@ -1,16 +1,18 @@  -using System.Data; -using System.Runtime.InteropServices; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; + namespace BeautySalonContracts.StorageContracts { public interface ICosmeticStorage { - //CRUD - //public Create(new CosmeticBinngModel); - //public Read(); - //public Update(); - //public Deleted(); + List GetFullList(); + List GetFilteredList(CosmeticBindingModel model); + CosmeticViewModel GetElement(CosmeticBindingModel model); + CosmeticViewModel Insert(CosmeticBindingModel model); + CosmeticViewModel Update(CosmeticBindingModel model); + CosmeticViewModel Deleted(CosmeticBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IDistributionStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IDistributionStorage.cs index 9393ad6..8b80bad 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IDistributionStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IDistributionStorage.cs @@ -1,12 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IDistributionStorage + public interface IDistributionStorage { + List GetFullList(); + List GetFilteredList(DistributionBindingModel model); + DistributionViewModel GetElement(DistributionBindingModel model); + DistributionViewModel Insert(DistributionBindingModel model); + DistributionViewModel Update(DistributionBindingModel model); + DistributionViewModel Deleted(DistributionBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IEmployeeStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IEmployeeStorage.cs index 5dbc869..f0b43c5 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IEmployeeStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IEmployeeStorage.cs @@ -1,12 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IEmployeeStorage + public interface IEmployeeStorage { + List GetFullList(); + List GetFilteredList(EmployeeBindingModel model); + EmployeeViewModel GetElement(EmployeeBindingModel model); + EmployeeViewModel Insert(EmployeeBindingModel model); + EmployeeViewModel Update(EmployeeBindingModel model); + EmployeeViewModel Deleted(EmployeeBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IProcedureStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IProcedureStorage.cs index bd9bb61..6b74927 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IProcedureStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IProcedureStorage.cs @@ -1,12 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IProcedureStorage + public interface IProcedureStorage { + List GetFullList(); + List GetFilteredList(ProcedureBindingModel model); + ProcedureViewModel GetElement(ProcedureBindingModel model); + ProcedureViewModel Insert(ProcedureBindingModel model); + ProcedureViewModel Update(ProcedureBindingModel model); + ProcedureViewModel Deleted(ProcedureBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IPurchaseStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IPurchaseStorage.cs index 1f0d04f..e5a28c8 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IPurchaseStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IPurchaseStorage.cs @@ -1,12 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IPurchaseStorage + public interface IPurchaseStorage { + List GetFullList(); + List GetFilteredList(PurchaseBindingModel model); + PurchaseViewModel GetElement(PurchaseBindingModel model); + PurchaseViewModel Insert(PurchaseBindingModel model); + PurchaseViewModel Update(PurchaseBindingModel model); + PurchaseViewModel Deleted(PurchaseBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IReceiptStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IReceiptStorage.cs index c0ef4f2..095c0a3 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IReceiptStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IReceiptStorage.cs @@ -1,12 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IReceiptStorage + public interface IReceiptStorage { + List GetFullList(); + List GetFilteredList(ReceiptBindingModel model); + ReceiptViewModel GetElement(ReceiptBindingModel model); + ReceiptViewModel Insert(ReceiptBindingModel model); + ReceiptViewModel Update(ReceiptBindingModel model); + ReceiptViewModel Deleted(ReceiptBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/StorageContracts/IVisitStorage.cs b/BeautySalon/BeautySalonContracts/StorageContracts/IVisitStorage.cs index 2a40532..1f6003b 100644 --- a/BeautySalon/BeautySalonContracts/StorageContracts/IVisitStorage.cs +++ b/BeautySalon/BeautySalonContracts/StorageContracts/IVisitStorage.cs @@ -1,12 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; namespace BeautySalonContracts.StorageContracts { - internal interface IVisitStorage + public interface IVisitStorage { + List GetFullList(); + List GetFilteredList(VisitBindingModel model); + VisitViewModel GetElement(VisitBindingModel model); + VisitViewModel Insert(VisitBindingModel model); + VisitViewModel Update(VisitBindingModel model); + VisitViewModel Deleted(VisitBindingModel model); } } diff --git a/BeautySalon/BeautySalonContracts/ViewModels/PurchaseViewModel.cs b/BeautySalon/BeautySalonContracts/ViewModels/PurchaseViewModel.cs index a2ef10b..29898ec 100644 --- a/BeautySalon/BeautySalonContracts/ViewModels/PurchaseViewModel.cs +++ b/BeautySalon/BeautySalonContracts/ViewModels/PurchaseViewModel.cs @@ -9,6 +9,6 @@ namespace BeautySalonContracts.ViewModels [DisplayName("Дата покупки")] public DateTime Date { get; set; } [DisplayName("Сумма")] - public double Sum { get; } + public double Sum { get; set; } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/BeautySalonDatabaseImplement.csproj b/BeautySalon/BeautySalonDatabaseImplement/BeautySalonListImplement.csproj similarity index 73% rename from BeautySalon/BeautySalonDatabaseImplement/BeautySalonDatabaseImplement.csproj rename to BeautySalon/BeautySalonDatabaseImplement/BeautySalonListImplement.csproj index 6aa3b78..aaaa7e8 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/BeautySalonDatabaseImplement.csproj +++ b/BeautySalon/BeautySalonDatabaseImplement/BeautySalonListImplement.csproj @@ -7,7 +7,7 @@ - + diff --git a/BeautySalon/BeautySalonDatabaseImplement/DataListSingleton.cs b/BeautySalon/BeautySalonDatabaseImplement/DataListSingleton.cs new file mode 100644 index 0000000..9ecb2c2 --- /dev/null +++ b/BeautySalon/BeautySalonDatabaseImplement/DataListSingleton.cs @@ -0,0 +1,39 @@ + +using BeautySalonDatabaseImplement.Models; + +namespace BeautySalonListImplement +{ + public class DataListSingleton + { + private static DataListSingleton? _instance; + + public List Clients { get; set; } + public List Cosmetics { get; set; } + public List Distributions { get; set; } + public List Employees { get; set; } + public List Procedures { get; set; } + public List Purchases { get; set; } + public List Receipts { get; set; } + public List Visits { get; set; } + + private DataListSingleton() + { + Clients = new List(); + Cosmetics = new List(); + Distributions = new List(); + Employees = new List(); + Procedures = new List(); + Purchases = new List(); + Receipts = new List(); + Visits = new List(); + } + public static DataListSingleton GetInstance() + { + if (_instance == null) + { + _instance = new DataListSingleton(); + } + return _instance; + } + } +} diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/ClientStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/ClientStorage.cs index 5bf6446..b7accba 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/ClientStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/ClientStorage.cs @@ -1,12 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; + namespace BeautySalonDatabaseImplement.Implements { internal class ClientStorage : IClientStorage { + public ClientViewModel Deleted(ClientBindingModel model) + { + throw new NotImplementedException(); + } + + public ClientViewModel GetElement(ClientBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(ClientBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public ClientViewModel Insert(ClientBindingModel model) + { + throw new NotImplementedException(); + } + + public ClientViewModel Update(ClientBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/CosmeticStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/CosmeticStorage.cs index dc107b1..3d6daae 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/CosmeticStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/CosmeticStorage.cs @@ -1,12 +1,48 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; +using BeautySalonListImplement; namespace BeautySalonDatabaseImplement.Implements { - internal class CosmeticStorage : ICosmeticStorage + public class CosmeticStorage : ICosmeticStorage { + private readonly DataListSingleton _source; + public CosmeticStorage() + { + _source = DataListSingleton.GetInstance(); + } + public CosmeticViewModel GetElement(CosmeticBindingModel model) + { + foreach(var cosmetic in _source.Cosmetics) + + } + + public List GetFilteredList(CosmeticBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public CosmeticViewModel Insert(CosmeticBindingModel model) + { + throw new NotImplementedException(); + } + + public CosmeticViewModel Update(CosmeticBindingModel model) + { + throw new NotImplementedException(); + } + + public CosmeticViewModel Deleted(CosmeticBindingModel model) + { + throw new NotImplementedException(); + } + } } + \ No newline at end of file diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/DistributionStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/DistributionStorage.cs index ad28e44..a1a136e 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/DistributionStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/DistributionStorage.cs @@ -1,12 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Implements { internal class DistributionStorage : IDistributionStorage { + public DistributionViewModel Deleted(DistributionBindingModel model) + { + throw new NotImplementedException(); + } + + public DistributionViewModel GetElement(DistributionBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(DistributionBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public DistributionViewModel Insert(DistributionBindingModel model) + { + throw new NotImplementedException(); + } + + public DistributionViewModel Update(DistributionBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/EmployeeStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/EmployeeStorage.cs index 04ec213..6fa2f02 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/EmployeeStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/EmployeeStorage.cs @@ -1,12 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Implements { internal class EmployeeStorage : IEmployeeStorage { + public EmployeeViewModel Deleted(EmployeeBindingModel model) + { + throw new NotImplementedException(); + } + + public EmployeeViewModel GetElement(EmployeeBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(EmployeeBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public EmployeeViewModel Insert(EmployeeBindingModel model) + { + throw new NotImplementedException(); + } + + public EmployeeViewModel Update(EmployeeBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/ProcedureStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/ProcedureStorage.cs index f327b3b..b248a75 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/ProcedureStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/ProcedureStorage.cs @@ -1,12 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Implements { internal class ProcedureStorage : IProcedureStorage { + public ProcedureViewModel Deleted(ProcedureBindingModel model) + { + throw new NotImplementedException(); + } + + public ProcedureViewModel GetElement(ProcedureBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(ProcedureBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public ProcedureViewModel Insert(ProcedureBindingModel model) + { + throw new NotImplementedException(); + } + + public ProcedureViewModel Update(ProcedureBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/PurchaseStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/PurchaseStorage.cs index 0d0f2ae..599042d 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/PurchaseStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/PurchaseStorage.cs @@ -1,12 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Implements { internal class PurchaseStorage : IPurchaseStorage { + public PurchaseViewModel Deleted(PurchaseBindingModel model) + { + throw new NotImplementedException(); + } + + public PurchaseViewModel GetElement(PurchaseBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(PurchaseBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public PurchaseViewModel Insert(PurchaseBindingModel model) + { + throw new NotImplementedException(); + } + + public PurchaseViewModel Update(PurchaseBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/ReceiptStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/ReceiptStorage.cs index a9f2d08..04aee07 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/ReceiptStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/ReceiptStorage.cs @@ -1,12 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Implements { internal class ReceiptStorage : IReceiptStorage { + public ReceiptViewModel Deleted(ReceiptBindingModel model) + { + throw new NotImplementedException(); + } + + public ReceiptViewModel GetElement(ReceiptBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(ReceiptBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public ReceiptViewModel Insert(ReceiptBindingModel model) + { + throw new NotImplementedException(); + } + + public ReceiptViewModel Update(ReceiptBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Implements/VisitStorage.cs b/BeautySalon/BeautySalonDatabaseImplement/Implements/VisitStorage.cs index acd7834..03f5d0c 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Implements/VisitStorage.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Implements/VisitStorage.cs @@ -1,12 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.StorageContracts; +using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Implements { internal class VisitStorage : IVisitStorage { + public VisitViewModel Deleted(VisitBindingModel model) + { + throw new NotImplementedException(); + } + + public VisitViewModel GetElement(VisitBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFilteredList(VisitBindingModel model) + { + throw new NotImplementedException(); + } + + public List GetFullList() + { + throw new NotImplementedException(); + } + + public VisitViewModel Insert(VisitBindingModel model) + { + throw new NotImplementedException(); + } + + public VisitViewModel Update(VisitBindingModel model) + { + throw new NotImplementedException(); + } } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Client.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Client.cs index b9c35b6..e10acd9 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Client.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Client.cs @@ -1,4 +1,8 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; +using System.Diagnostics; + namespace BeautySalonDatabaseImplement.Models { public class Client @@ -9,5 +13,45 @@ namespace BeautySalonDatabaseImplement.Models public string? Login { get; set; } public string? Password { get; set; } public string? Phone { get; set; } + + public static Client? Create(ClientBindingModel model) + { + if (model == null) + { + return null; + } + return new Client + { + Id = model.Id, + Name = model.Name, + Surname = model.Surname, + Login = model.Login, + Password = model.Password, + Phone = model.Phone, + }; + + } + public void Update(ClientBindingModel model) + { + if (model == null) + { + return; + } + + Name = model.Name; + Surname = model.Surname; + Login = model.Login; + Password = model.Password; + Phone = model.Phone; + } + public ClientViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Surname = Surname, + Login = Login, + Password = Password, + Phone = Phone + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Cosmetic.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Cosmetic.cs index 35ba056..017d16a 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Cosmetic.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Cosmetic.cs @@ -1,4 +1,7 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; + namespace BeautySalonDatabaseImplement.Models { public class Cosmetic @@ -7,6 +10,35 @@ namespace BeautySalonDatabaseImplement.Models public string? Name { get; set; } public double Price { get; set; } - + public static Cosmetic? Create(CosmeticBindingModel model) + { + if (model == null) + { + return null; + } + return new Cosmetic + { + Id = model.Id, + Name = model.Name, + Price = model.Price + }; + + } + public void Update(CosmeticBindingModel model) + { + if (model == null) + { + return; + } + + Name = model.Name; + Price = model.Price; + } + public CosmeticViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Price = Price + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Distribution.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Distribution.cs index ce13603..4ec3647 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Distribution.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Distribution.cs @@ -1,4 +1,10 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; +using System.Numerics; +using System.Reflection; +using System.Xml.Linq; + namespace BeautySalonDatabaseImplement.Models { public class Distribution @@ -6,5 +12,34 @@ namespace BeautySalonDatabaseImplement.Models public int Id { get; set; } public DateTime Date { get; set; } public double Sum { get; set; } + public static Distribution? Create(DistributionBindingModel model) + { + if (model == null) + { + return null; + } + return new Distribution + { + Id = model.Id, + Date = model.Date, + Sum = model.Sum + }; + + } + public void Update(DistributionBindingModel model) + { + if (model == null) + { + return; + } + Date = model.Date; + Sum = model.Sum; + } + public DistributionViewModel GetViewModel => new() + { + Id = Id, + Date = Date, + Sum = Sum + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Employee.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Employee.cs index 04851ce..4272280 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Employee.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Employee.cs @@ -1,4 +1,7 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; + namespace BeautySalonDatabaseImplement.Models { public class Employee @@ -9,5 +12,44 @@ namespace BeautySalonDatabaseImplement.Models public string? Login { get; set; } public string? Password { get; set; } public string? Phone { get; set; } + public static Employee? Create(EmployeeBindingModel model) + { + if (model == null) + { + return null; + } + return new Employee + { + Id = model.Id, + Name = model.Name, + Surname = model.Surname, + Login = model.Login, + Password = model.Password, + Phone = model.Phone, + }; + + } + public void Update(EmployeeBindingModel model) + { + if (model == null) + { + return; + } + + Name = model.Name; + Surname = model.Surname; + Login = model.Login; + Password = model.Password; + Phone = model.Phone; + } + public EmployeeViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Surname = Surname, + Login = Login, + Password = Password, + Phone = Phone + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Procedure.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Procedure.cs index 45bc0dc..766ceed 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Procedure.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Procedure.cs @@ -1,4 +1,8 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; +using System.Reflection; + namespace BeautySalonDatabaseImplement.Models { public class Procedure @@ -7,5 +11,38 @@ namespace BeautySalonDatabaseImplement.Models public string? Name { get; set; } public double Price { get; set; } public string? FIO_Master { get; set; } + public static Procedure? Create(ProcedureBindingModel model) + { + if (model == null) + { + return null; + } + return new Procedure + { + Id = model.Id, + Name = model.Name, + Price = model.Price, + FIO_Master = model.FIO_Master + }; + + } + public void Update(ProcedureBindingModel model) + { + if (model == null) + { + return; + } + + Name = model.Name; + Price = model.Price; + FIO_Master = model.FIO_Master; + } + public ProcedureViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Price = Price, + FIO_Master = FIO_Master + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Purchase.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Purchase.cs index 6e09294..6fbb1bb 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Purchase.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Purchase.cs @@ -1,10 +1,42 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; + namespace BeautySalonDatabaseImplement.Models { public class Purchase { public int Id { get; set; } public DateTime Date { get; set; } - public double Sum { get;} + public double Sum { get; set; } + public static Purchase? Create(PurchaseBindingModel model) + { + if (model == null) + { + return null; + } + return new Purchase + { + Id = model.Id, + Date = model.Date, + Sum = model.Sum + }; + + } + public void Update(PurchaseBindingModel model) + { + if (model == null) + { + return; + } + Date = model.Date; + Sum = model.Sum; + } + public PurchaseViewModel GetViewModel => new() + { + Id = Id, + Date = Date, + Sum = Sum + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Receipt.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Receipt.cs index 5314362..f6bb5e4 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Receipt.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Receipt.cs @@ -1,4 +1,7 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; + namespace BeautySalonDatabaseImplement.Models { public class Receipt @@ -6,5 +9,34 @@ namespace BeautySalonDatabaseImplement.Models public int Id { get; set; } public DateTime Date { get; set; } public double Sum { get; set; } + public static Receipt? Create(ReceiptBindingModel model) + { + if (model == null) + { + return null; + } + return new Receipt + { + Id = model.Id, + Date = model.Date, + Sum = model.Sum + }; + + } + public void Update(ReceiptBindingModel model) + { + if (model == null) + { + return; + } + Date = model.Date; + Sum = model.Sum; + } + public ReceiptViewModel GetViewModel => new() + { + Id = Id, + Date = Date, + Sum = Sum + }; } } diff --git a/BeautySalon/BeautySalonDatabaseImplement/Models/Visit.cs b/BeautySalon/BeautySalonDatabaseImplement/Models/Visit.cs index 97f0839..67275c1 100644 --- a/BeautySalon/BeautySalonDatabaseImplement/Models/Visit.cs +++ b/BeautySalon/BeautySalonDatabaseImplement/Models/Visit.cs @@ -1,4 +1,7 @@  +using BeautySalonContracts.BindingModels; +using BeautySalonContracts.ViewModels; + namespace BeautySalonDatabaseImplement.Models { public class Visit @@ -6,5 +9,35 @@ namespace BeautySalonDatabaseImplement.Models public int Id { get; set; } public DateTime Date { get; set; } public double Sum { get; set; } + + public static Visit? Create(VisitBindingModel model) + { + if (model == null) + { + return null; + } + return new Visit + { + Id = model.Id, + Date = model.Date, + Sum = model.Sum + }; + + } + public void Update(VisitBindingModel model) + { + if (model == null) + { + return; + } + Date = model.Date; + Sum = model.Sum; + } + public VisitViewModel GetViewModel => new() + { + Id = Id, + Date = Date, + Sum = Sum + }; } }