diff --git a/SushiBar/SushiBarBusinessLogic/App.config b/SushiBar/SushiBarBusinessLogic/App.config
deleted file mode 100644
index 56efbc7..0000000
--- a/SushiBar/SushiBarBusinessLogic/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SushiBar/SushiBarBusinessLogic/ComponentLogic.cs b/SushiBar/SushiBarBusinessLogic/ComponentLogic.cs
deleted file mode 100644
index f4885e5..0000000
--- a/SushiBar/SushiBarBusinessLogic/ComponentLogic.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SushiBarBusinessLogic.BusinessLogics
-{
- public class ComponentLogic
- private readonly ILogger _logger;
- private readonly IComponentStorage _componentStorage;
- public ComponentLogic(ILogger logger, IComponentStorage
- componentStorage)
- {
- _logger = logger;
- _componentStorage = componentStorage;
- }
- public List? ReadList(ComponentSearchModel? model)
- {
- _logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:{ Id}", model?.ComponentName, model?.Id);
- var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
- if (list == null)
- {
- _logger.LogWarning("ReadList return null list");
- return null;
- }
- _logger.LogInformation("ReadList. Count:{Count}", list.Count);
- return list;
- }
- public ComponentViewModel? ReadElement(ComponentSearchModel model)
- {
- if (model == null)
- {
- throw new ArgumentNullException(nameof(model));
- }
- _logger.LogInformation("ReadElement. ComponentName:{ComponentName}. Id:{ Id} ", model.ComponentName, model.Id);
- var element = _componentStorage.GetElement(model);
- if (element == null)
- {
- _logger.LogWarning("ReadElement element not found");
- return null;
- }
- _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
- return element;
- }
- public bool Create(ComponentBindingModel model)
- {
- CheckModel(model);
- if (_componentStorage.Insert(model) == null)
- {
- _logger.LogWarning("Insert operation failed");
- return false;
- }
- return true;
- }
- public bool Update(ComponentBindingModel model)
- {
- CheckModel(model);
- if (_componentStorage.Update(model) == null)
- {
- _logger.LogWarning("Update operation failed");
- return false;
- }
- return true;
- }
- public bool Delete(ComponentBindingModel model)
- {
- CheckModel(model, false);
- _logger.LogInformation("Delete. Id:{Id}", model.Id);
- if (_componentStorage.Delete(model) == null)
- {
- _logger.LogWarning("Delete operation failed");
- return false;
- }
- return true;
- }
- private void CheckModel(ComponentBindingModel model, bool withParams =
- true)
- {
- if (model == null)
- {
- throw new ArgumentNullException(nameof(model));
- }
- if (!withParams)
- {
- return;
- }
- if (string.IsNullOrEmpty(model.ComponentName))
- {
- throw new ArgumentNullException("Нет названия компонента",
- nameof(model.ComponentName));
- }
- if (model.Cost <= 0)
- {
- throw new ArgumentNullException("Цена компонента должна быть
- больше 0", nameof(model.Cost));
- }
- _logger.LogInformation("Component. ComponentName:{ComponentName}.
- Cost:{ Cost}. Id: { Id}
- ", model.ComponentName, model.Cost, model.Id);
- var element = _componentStorage.GetElement(new ComponentSearchModel
- {
- ComponentName = model.ComponentName
- });
- if (element != null && element.Id != model.Id)
- {
- throw new InvalidOperationException("Компонент с таким названием
- уже есть");
- }
- }
-}
diff --git a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj b/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj
deleted file mode 100644
index 166199b..0000000
--- a/SushiBar/SushiBarBusinessLogic/SushiBarBusinessLogic.csproj
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {E9064087-924C-4E00-A9EA-8E922CF49D11}
- Exe
- SushiBarBusinessLogic
- SushiBarBusinessLogic
- v4.7.2
- 512
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
- {993e0787-3ad5-4743-8997-c828cd0cdc10}
- SushiBarContracts
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SushiBar/SushiBarBusinessLogic_/ClientLogic.cs b/SushiBar/SushiBarBusinessLogic_/ClientLogic.cs
new file mode 100644
index 0000000..32093b5
--- /dev/null
+++ b/SushiBar/SushiBarBusinessLogic_/ClientLogic.cs
@@ -0,0 +1,119 @@
+using Microsoft.Extensions.Logging;
+using SushiBar.BindingModels;
+using SushiBar.BusinessLogicsContracts;
+using SushiBar.SearchModels;
+using SushiBar.StoragesContracts;
+using SushiBar.ViewModels;
+
+namespace SushiBarBusinessLogic.BusinessLogics
+{
+ public class ClientLogic : IClientLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IClientStorage _clientStorage;
+
+ public ClientLogic(ILogger logger, IClientStorage clientStorage)
+ {
+ _logger = logger;
+ _clientStorage = clientStorage;
+ }
+
+ public List? ReadList(ClientSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. ClientId:{Id}", model?.Id);
+ var list = model == null ? _clientStorage.GetFullList() : _clientStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+
+ public ClientViewModel? ReadElement(ClientSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. ClientFio:{ClientFio}.Id:{ Id}", model.ClientFIO, model.Id);
+ var element = _clientStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public bool Create(ClientBindingModel model)
+ {
+ CheckModel(model);
+ if (_clientStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Update(ClientBindingModel model)
+ {
+ CheckModel(model);
+ if (_clientStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(ClientBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_clientStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(ClientBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.ClientFIO))
+ {
+ throw new ArgumentNullException("Нет ФИО пользователя", nameof(model.ClientFIO));
+ }
+ if (string.IsNullOrEmpty(model.Email))
+ {
+ throw new ArgumentNullException("Нет почты пользователя", nameof(model.Email));
+ }
+ if (string.IsNullOrEmpty(model.Password))
+ {
+ throw new ArgumentNullException("Нет пароля пользователя", nameof(model.Password));
+ }
+ _logger.LogInformation("Client. ClientFIO:{ClientFIO}.Email:{Email}.Password:{Password}.Id:{Id}",
+ model.ClientFIO, model.Email, model.Password, model.Id);
+ var element = _clientStorage.GetElement(new ClientSearchModel
+ {
+ ClientFIO = model.ClientFIO
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Клиент с таким именем уже есть");
+ }
+ }
+ }
+}
diff --git a/SushiBar/SushiBarContracts/BindingModels/ClientBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/ClientBindingModel.cs
new file mode 100644
index 0000000..7fa1faa
--- /dev/null
+++ b/SushiBar/SushiBarContracts/BindingModels/ClientBindingModel.cs
@@ -0,0 +1,13 @@
+using SushiBarDataModels.Models;
+
+namespace SushiBar.BindingModels
+{
+ public class ClientBindingModel : IClientModel
+ {
+ public int Id { get; set; }
+ public string ClientFIO { get; set; } = string.Empty;
+ public string Email { get; set; } = string.Empty;
+ public string Password { get; set; } = string.Empty;
+ }
+
+}
diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IClientLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IClientLogic.cs
new file mode 100644
index 0000000..9aec457
--- /dev/null
+++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IClientLogic.cs
@@ -0,0 +1,15 @@
+using SushiBar.BindingModels;
+using SushiBar.ViewModels;
+using SushiBar.SearchModels;
+
+namespace SushiBar.BusinessLogicsContracts
+{
+ public interface IClientLogic
+ {
+ List? ReadList(ClientSearchModel? model);
+ ClientViewModel? ReadElement(ClientSearchModel model);
+ bool Create(ClientBindingModel model);
+ bool Update(ClientBindingModel model);
+ bool Delete(ClientBindingModel model);
+ }
+}
diff --git a/SushiBar/SushiBarContracts/SearchModels/ClientSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/ClientSearchModel.cs
new file mode 100644
index 0000000..a234f96
--- /dev/null
+++ b/SushiBar/SushiBarContracts/SearchModels/ClientSearchModel.cs
@@ -0,0 +1,13 @@
+namespace SushiBar.SearchModels
+{
+ public class ClientSearchModel
+ {
+ public int? Id { get; set; }
+
+ public string? ClientFIO { get; set; }
+
+ public string? Email { get; set; }
+
+ public string? Password { get; set; }
+ }
+}
diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IClientStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IClientStorage.cs
new file mode 100644
index 0000000..72888e7
--- /dev/null
+++ b/SushiBar/SushiBarContracts/StoragesContracts/IClientStorage.cs
@@ -0,0 +1,21 @@
+using SushiBar.BindingModels;
+using SushiBar.SearchModels;
+using SushiBar.ViewModels;
+
+namespace SushiBar.StoragesContracts
+{
+ public interface IClientStorage
+ {
+ List GetFullList();
+
+ List GetFilteredList(ClientSearchModel model);
+
+ ClientViewModel? GetElement(ClientSearchModel model);
+
+ ClientViewModel? Insert(ClientBindingModel model);
+
+ ClientViewModel? Update(ClientBindingModel model);
+
+ ClientViewModel? Delete(ClientBindingModel model);
+ }
+}
diff --git a/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs
new file mode 100644
index 0000000..28f55a9
--- /dev/null
+++ b/SushiBar/SushiBarContracts/ViewModels/ClientViewModel.cs
@@ -0,0 +1,16 @@
+using SushiBarDataModels.Models;
+using System.ComponentModel;
+
+namespace SushiBar.ViewModels
+{
+ public class ClientViewModel : IClientModel
+ {
+ public int Id { get; set; }
+ [DisplayName("ФИО клиента")]
+ public string ClientFIO { get; set; } = string.Empty;
+ [DisplayName("Логин (эл. почта)")]
+ public string Email { get; set; } = string.Empty;
+ [DisplayName("Пароль")]
+ public string Password { get; set; } = string.Empty;
+ }
+}
diff --git a/SushiBar/SushiBarContracts/ViewModels/ReportPizzaComponentViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ReportSushiComponentViewModel.cs
similarity index 100%
rename from SushiBar/SushiBarContracts/ViewModels/ReportPizzaComponentViewModel.cs
rename to SushiBar/SushiBarContracts/ViewModels/ReportSushiComponentViewModel.cs
diff --git a/SushiBar/SushiBarDataModels/Models/IClientModel.cs b/SushiBar/SushiBarDataModels/Models/IClientModel.cs
new file mode 100644
index 0000000..91f1ea9
--- /dev/null
+++ b/SushiBar/SushiBarDataModels/Models/IClientModel.cs
@@ -0,0 +1,11 @@
+namespace SushiBarDataModels.Models
+{
+ public interface IClientModel : IId
+ {
+ string ClientFIO { get; }
+
+ string Email { get; }
+
+ string Password { get; }
+ }
+}
diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Client.cs b/SushiBar/SushiBarDatabaseImplement/Models/Client.cs
new file mode 100644
index 0000000..e517239
--- /dev/null
+++ b/SushiBar/SushiBarDatabaseImplement/Models/Client.cs
@@ -0,0 +1,76 @@
+using SushiBar.BindingModels;
+using SushiBar.ViewModels;
+using SushiBarContracts.BindingModels;
+using SushiBarContracts.ViewModels;
+using SushiBarDataModels.Models;
+using SushiBarListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PizzeriaDatabaseImplement.Models
+{
+ public class Client : IClientModel
+ {
+ public int Id { get; private set; }
+
+ [Required]
+ public string ClientFIO { get; set; } = string.Empty;
+ [Required]
+ public string Email { get; set; } = string.Empty;
+ [Required]
+ public string Password { get; set; } = string.Empty;
+
+ [ForeignKey("ClientId")]
+ public virtual List Orders { get; set; } = new();
+
+ public static Client? Create(ClientBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Client()
+ {
+ Id = model.Id,
+ ClientFIO = model.ClientFIO,
+ Email = model.Email,
+ Password = model.Password
+ };
+ }
+
+ public static Client Create(ClientViewModel model)
+ {
+ return new Client
+ {
+ Id = model.Id,
+ ClientFIO = model.ClientFIO,
+ Email = model.Email,
+ Password = model.Password
+ };
+ }
+
+ public void Update(ClientBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ClientFIO = model.ClientFIO;
+ Email = model.Email;
+ Password = model.Password;
+ }
+
+ public ClientViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ClientFIO = ClientFIO,
+ Email = Email,
+ Password = Password
+ };
+ }
+}
diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj
index 3e8ca0c..5fcfde6 100644
--- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj
+++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj
@@ -18,6 +18,7 @@
+
diff --git a/SushiBar/SushiBarFileImplement/Models/Client.cs b/SushiBar/SushiBarFileImplement/Models/Client.cs
new file mode 100644
index 0000000..cbc109f
--- /dev/null
+++ b/SushiBar/SushiBarFileImplement/Models/Client.cs
@@ -0,0 +1,72 @@
+using SushiBar.BindingModels;
+using SushiBar.ViewModels;
+using SushiBarContracts.BindingModels;
+using SushiBarContracts.ViewModels;
+using SushiBarDataModels.Models;
+using System.Xml.Linq;
+
+namespace PizzeriaFileImplement.Models
+{
+ public class Client : IClientModel
+ {
+ public int Id { get; set; }
+ public string ClientFIO { get; set; } = string.Empty;
+ public string Password { get; set; } = string.Empty;
+ public string Email { get; set; } = string.Empty;
+
+ public static Client? Create(ClientBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Client()
+ {
+ Id = model.Id,
+ ClientFIO = model.ClientFIO,
+ Password = model.Password,
+ Email = model.Email
+ };
+ }
+
+ public static Client? Create(XElement element)
+ {
+ if (element == null)
+ {
+ return null;
+ }
+ return new Client()
+ {
+ Id = Convert.ToInt32(element.Attribute("Id")!.Value),
+ ClientFIO = element.Attribute("ClientFIO")!.Value,
+ Password = element.Attribute("Password")!.Value,
+ Email = element.Attribute("Email")!.Value
+ };
+ }
+
+ public void Update(ClientBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ClientFIO = model.ClientFIO;
+ Password = model.Password;
+ Email = model.Email;
+ }
+
+ public ClientViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ClientFIO = ClientFIO,
+ Password = Password,
+ Email = Email
+ };
+
+ public XElement GetXElement => new("Client",
+ new XAttribute("Id", Id),
+ new XElement("ClientFIO", ClientFIO),
+ new XElement("Password", Password),
+ new XElement("Email", Email));
+ }
+}
diff --git a/SushiBar/SushiBarListImplement/App.config b/SushiBar/SushiBarListImplement/App.config
deleted file mode 100644
index 56efbc7..0000000
--- a/SushiBar/SushiBarListImplement/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SushiBar/SushiBarListImplement/Component.cs b/SushiBar/SushiBarListImplement/Component.cs
deleted file mode 100644
index 453d89c..0000000
--- a/SushiBar/SushiBarListImplement/Component.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SushiBarListImplement.Models
-{
- public class Component : IComponentModel
- {
- public int Id { get; private set; }
- public string ComponentName { get; private set; } = string.Empty;
- public double Cost { get; set; }
- public static Component? Create(ComponentBindingModel? model)
- {
- if (model == null)
- {
- return null;
- }
- return new Component()
- {
- Id = model.Id,
- ComponentName = model.ComponentName,
- Cost = model.Cost
- };
- }
- public void Update(ComponentBindingModel? model)
- {
- if (model == null)
- {
- return;
- }
- ComponentName = model.ComponentName;
- Cost = model.Cost;
- }
- public ComponentViewModel GetViewModel => new()
- {
- Id = Id,
- ComponentName = ComponentName,
- Cost = Cost
- };
- }
-}
diff --git a/SushiBar/SushiBarListImplement/ComponentStorage.cs b/SushiBar/SushiBarListImplement/ComponentStorage.cs
deleted file mode 100644
index e06268f..0000000
--- a/SushiBar/SushiBarListImplement/ComponentStorage.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SushiBarContracts.BindingModels;
-using SushiBarContracts.SearchModels;
-using SushiBarContracts.StoragesContracts;
-using SushiBarContracts.ViewModels;
-using SushiBarListImplement.Models;
-
-namespace SushiBarListImplement.Implements
-{
- internal class ComponentStorage : IComponentStorage
- {
- private readonly DataListSingleton _source;
- public ComponentStorage()
- {
- _source = DataListSingleton.GetInstance();
- }
- public List GetFullList()
- {
- var result = new List();
- foreach (var component in _source.Components)
- {
- result.Add(component.GetViewModel);
- }
- return result;
- }
- public List GetFilteredList(ComponentSearchModel
- model)
- {
- var result = new List();
- if (string.IsNullOrEmpty(model.ComponentName))
- {
- return result;
- }
- foreach (var component in _source.Components)
- {
- if (component.ComponentName.Contains(model.ComponentName))
- {
- result.Add(component.GetViewModel);
- }
- }
- return result;
- }
- public ComponentViewModel? GetElement(ComponentSearchModel model)
- {
- if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
- {
- return null;
- }
- foreach (var component in _source.Components)
- {
- if ((!string.IsNullOrEmpty(model.ComponentName) &&
- component.ComponentName == model.ComponentName) ||
- (model.Id.HasValue && component.Id == model.Id))
- {
- return component.GetViewModel;
- }
- }
- return null;
- }
- public ComponentViewModel? Insert(ComponentBindingModel model)
- {
- model.Id = 1;
- foreach (var component in _source.Components)
- {
- if (model.Id <= component.Id)
- {
- model.Id = component.Id + 1;
- }
- }
- var newComponent = Component.Create(model);
- if (newComponent == null)
- {
- return null;
- }
- _source.Components.Add(newComponent);
- return newComponent.GetViewModel;
- }
- public ComponentViewModel? Update(ComponentBindingModel model)
- {
- foreach (var component in _source.Components)
- {
- if (component.Id == model.Id)
- {
- component.Update(model);
- return component.GetViewModel;
- }
- }
- return null;
- }
- public ComponentViewModel? Delete(ComponentBindingModel model)
- {
- for (int i = 0; i < _source.Components.Count; ++i)
- {
- if (_source.Components[i].Id == model.Id)
- {
- var element = _source.Components[i];
- _source.Components.RemoveAt(i);
- return element.GetViewModel;
- }
- }
- return null;
- }
- }
-
-}
-}
diff --git a/SushiBar/SushiBarListImplement/DataListSingleton.cs b/SushiBar/SushiBarListImplement/DataListSingleton.cs
deleted file mode 100644
index f0f9a1b..0000000
--- a/SushiBar/SushiBarListImplement/DataListSingleton.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SushiBarListImplement.Models;
-
-namespace SushiBarListImplement
-{
- public class DataListSingleton
- {
- private static DataListSingleton? _instance;
- public List Components { get; set; }
- public List Orders { get; set; }
- public List Products { get; set; }
- private DataListSingleton()
- {
- Components = new List();
- Orders = new List();
- Products = new List();
- }
- public static DataListSingleton GetInstance()
- {
- if (_instance == null)
- {
- _instance = new DataListSingleton();
- }
- return _instance;
- }
- }
-}
diff --git a/SushiBar/SushiBarListImplement/Sushi.cs b/SushiBar/SushiBarListImplement/Sushi.cs
deleted file mode 100644
index 133090b..0000000
--- a/SushiBar/SushiBarListImplement/Sushi.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SushiBarListImplement.Models
-{
- internal class Sushi : IProductModel
- {
- public int Id { get; private set; }
- public string ProductName { get; private set; } = string.Empty;
- public double Price { get; private set; }
- public Dictionary ProductComponents
- {
- get;
- private set;
- } = new Dictionary();
- public static Product? Create(ProductBindingModel? model)
- {
- if (model == null)
- {
- return null;
- }
- return new Product()
- {
- Id = model.Id,
- ProductName = model.ProductName,
- Price = model.Price,
- ProductComponents = model.ProductComponents
- };
- }
- public void Update(ProductBindingModel? model)
- {
- if (model == null)
- {
- return;
- }
- ProductName = model.ProductName;
- Price = model.Price;
- ProductComponents = model.ProductComponents;
- }
- public ProductViewModel GetViewModel => new()
- {
- Id = Id,
- ProductName = ProductName,
- Price = Price,
- ProductComponents = ProductComponents
- };
-
- }
-}
diff --git a/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj b/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj
deleted file mode 100644
index bbf9d38..0000000
--- a/SushiBar/SushiBarListImplement/SushiBarListImplement.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {1BBC3A4B-BF06-4EBF-AA20-863B369E234E}
- Exe
- SushiBarListImplement
- SushiBarListImplement
- v4.7.2
- 512
- true
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
- {993e0787-3ad5-4743-8997-c828cd0cdc10}
- SushiBarContracts
-
-
- {76043de7-71bc-41e8-b4c0-ecfaddfbf55f}
- SushiBarDataModels
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SushiBar/SushiBarListImplement_/Models/Client.cs b/SushiBar/SushiBarListImplement_/Models/Client.cs
new file mode 100644
index 0000000..c72d83e
--- /dev/null
+++ b/SushiBar/SushiBarListImplement_/Models/Client.cs
@@ -0,0 +1,50 @@
+using SushiBar.BindingModels;
+using SushiBar.ViewModels;
+using SushiBarContracts.BindingModels;
+using SushiBarContracts.ViewModels;
+using SushiBarDataModels.Models;
+
+namespace PizzeriaListImplement.Models
+{
+ public class Client : IClientModel
+ {
+ public int Id { get; private set; }
+ public string ClientFIO { get; private set; } = string.Empty;
+ public string Email { get; set; } = string.Empty;
+ public string Password { get; set; } = string.Empty;
+
+ public static Client? Create(ClientBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Client()
+ {
+ Id = model.Id,
+ ClientFIO = model.ClientFIO,
+ Email = model.Email,
+ Password = model.Password
+ };
+ }
+
+ public void Update(ClientBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ClientFIO = model.ClientFIO;
+ Email = model.Email;
+ Password = model.Password;
+ }
+
+ public ClientViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ClientFIO = ClientFIO,
+ Email = Email,
+ Password = Password,
+ };
+ }
+}