From 3e25205bf61eaa7092f993aeec78de6cd396c4c5 Mon Sep 17 00:00:00 2001 From: Viltskaa <andrewstyou@gmail.com> Date: Mon, 30 Jan 2023 18:27:32 +0400 Subject: [PATCH] Switch product to sushi --- .../BindingModels/OrderBindingModel.cs | 2 +- .../BindingModels/ProductBindingModel.cs | 12 ------------ .../BindingModels/SushiBindingModel.cs | 12 ++++++++++++ .../BusinessLogicsContracts/IProductLogic.cs | 15 --------------- .../BusinessLogicsContracts/ISushiLogic.cs | 15 +++++++++++++++ ...ProductSearchModel.cs => SushiSearchModel.cs} | 4 ++-- .../StoragesContracts/IProductStorage.cs | 16 ---------------- .../StoragesContracts/ISushiStorage.cs | 16 ++++++++++++++++ .../ViewModels/OrderViewModel.cs | 4 ++-- .../{ProductViewModel.cs => SushiViewModel.cs} | 6 +++--- SushiBar/SushiBarModels/Models/IOrderModel.cs | 2 +- SushiBar/SushiBarModels/Models/IProductModel.cs | 9 --------- SushiBar/SushiBarModels/Models/ISushiModel.cs | 9 +++++++++ 13 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs create mode 100644 SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs delete mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs create mode 100644 SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs rename SushiBar/SushiBarContracts/SearchModels/{ProductSearchModel.cs => SushiSearchModel.cs} (53%) delete mode 100644 SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs create mode 100644 SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs rename SushiBar/SushiBarContracts/ViewModels/{ProductViewModel.cs => SushiViewModel.cs} (56%) delete mode 100644 SushiBar/SushiBarModels/Models/IProductModel.cs create mode 100644 SushiBar/SushiBarModels/Models/ISushiModel.cs diff --git a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs index cc4f3a9..6428849 100644 --- a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs +++ b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs @@ -6,7 +6,7 @@ namespace SushiBarContracts.BindingModels public class OrderBindingModel : IOrderModel { public int Id { get; set; } - public int ProductId { get; set; } + public int SushiId { get; set; } public int Count { get; set; } public double Sum { get; set; } public OrderStatus Status { get; set; } = OrderStatus.Unknown; diff --git a/SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs deleted file mode 100644 index a356037..0000000 --- a/SushiBar/SushiBarContracts/BindingModels/ProductBindingModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -using SushiBarDataModels.Models; - -namespace SushiBarContracts.BindingModels -{ - public class ProductBindingModel : IProductModel - { - public int Id { get; set; } - public string ProductName { get; set; } = string.Empty; - public double Price { get; set; } - public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new(); - } -} diff --git a/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs new file mode 100644 index 0000000..110f4e2 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs @@ -0,0 +1,12 @@ +using SushiBarDataModels.Models; + +namespace SushiBarContracts.BindingModels +{ + public class SushiBindingModel : ISushiModel + { + public int Id { get; set; } + public string SushiName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary<int, (IComponentModel, int)> SushiComponents { get; set; } = new(); + } +} diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs deleted file mode 100644 index 96217a1..0000000 --- a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IProductLogic.cs +++ /dev/null @@ -1,15 +0,0 @@ -using SushiBarContracts.BindingModels; -using SushiBarContracts.SearchModels; -using SushiBarContracts.ViewModels; - -namespace SushiBarContracts.BusinessLogicsContracts -{ - public interface IProductLogic - { - List<ProductViewModel>? ReadList(ProductSearchModel? model); - ProductViewModel? ReadElement(ProductSearchModel model); - bool Create(ProductBindingModel model); - bool Update(ProductBindingModel model); - bool Delete(ProductBindingModel model); - } -} diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs new file mode 100644 index 0000000..ae5cbbb --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs @@ -0,0 +1,15 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + public interface ISushiLogic + { + List<SushiViewModel>? ReadList(SushiSearchModel? model); + SushiViewModel? ReadElement(SushiSearchModel model); + bool Create(SushiBindingModel model); + bool Update(SushiBindingModel model); + bool Delete(SushiBindingModel model); + } +} diff --git a/SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs similarity index 53% rename from SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs rename to SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs index 86bc1d7..55e424e 100644 --- a/SushiBar/SushiBarContracts/SearchModels/ProductSearchModel.cs +++ b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs @@ -1,8 +1,8 @@ namespace SushiBarContracts.SearchModels { - public class ProductSearchModel + public class SushiSearchModel { public int? Id { get; set; } - public string? ProductName { get; set; } + public string? SushiName { get; set; } } } diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs deleted file mode 100644 index 16e3db4..0000000 --- a/SushiBar/SushiBarContracts/StoragesContracts/IProductStorage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using SushiBarContracts.BindingModels; -using SushiBarContracts.SearchModels; -using SushiBarContracts.ViewModels; - -namespace SushiBarContracts.StoragesContracts -{ - public interface IProductStorage - { - List<ProductViewModel> GetFullList(); - List<ProductViewModel> GetFilteredList(ProductSearchModel model); - ProductViewModel? GetElement(ProductSearchModel model); - ProductViewModel? Insert(ProductBindingModel model); - ProductViewModel? Update(ProductBindingModel model); - ProductViewModel? Delete(ProductBindingModel model); - } -} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs new file mode 100644 index 0000000..ff49391 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs @@ -0,0 +1,16 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; + +namespace SushiBarContracts.StoragesContracts +{ + public interface ISushiStorage + { + List<SushiViewModel> GetFullList(); + List<SushiViewModel> GetFilteredList(SushiSearchModel model); + SushiViewModel? GetElement(SushiSearchModel model); + SushiViewModel? Insert(SushiBindingModel model); + SushiViewModel? Update(SushiBindingModel model); + SushiViewModel? Delete(SushiBindingModel model); + } +} diff --git a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs index 046385b..c31b276 100644 --- a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -8,10 +8,10 @@ namespace SushiBarContracts.ViewModels { [DisplayName("Number")] public int Id { get; set; } - public int ProductId { get; set; } + public int SushiId { get; set; } [DisplayName("Product")] - public string ProductName { get; set; } = string.Empty; + public string SushiName { get; set; } = string.Empty; [DisplayName("Count")] public int Count { get; set; } diff --git a/SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs similarity index 56% rename from SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs rename to SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs index 07ba88c..1567b04 100644 --- a/SushiBar/SushiBarContracts/ViewModels/ProductViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs @@ -3,15 +3,15 @@ using System.ComponentModel; namespace SushiBarContracts.ViewModels { - public class ProductViewModel : IProductModel + public class SushiViewModel : ISushiModel { public int Id { get; set; } [DisplayName("Name of Product")] - public string ProductName { get; set; } = string.Empty; + public string SushiName { get; set; } = string.Empty; [DisplayName("Cost")] public double Price { get; set; } - public Dictionary<int, (IComponentModel, int)> ProductComponents { get; set; } = new(); + public Dictionary<int, (IComponentModel, int)> SushiComponents { get; set; } = new(); } } diff --git a/SushiBar/SushiBarModels/Models/IOrderModel.cs b/SushiBar/SushiBarModels/Models/IOrderModel.cs index 501a9dc..3770e12 100644 --- a/SushiBar/SushiBarModels/Models/IOrderModel.cs +++ b/SushiBar/SushiBarModels/Models/IOrderModel.cs @@ -4,7 +4,7 @@ namespace SushiBarDataModels.Models { public interface IOrderModel : IId { - int ProductId { get; } + int SushiId { get; } int Count { get; } double Sum { get; } OrderStatus Status { get; } diff --git a/SushiBar/SushiBarModels/Models/IProductModel.cs b/SushiBar/SushiBarModels/Models/IProductModel.cs deleted file mode 100644 index 9af6d1b..0000000 --- a/SushiBar/SushiBarModels/Models/IProductModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SushiBarDataModels.Models -{ - public interface IProductModel : IId - { - string ProductName { get; } - double Price { get; } - Dictionary<int, (IComponentModel, int)> ProductComponents { get; } - } -} diff --git a/SushiBar/SushiBarModels/Models/ISushiModel.cs b/SushiBar/SushiBarModels/Models/ISushiModel.cs new file mode 100644 index 0000000..a04e269 --- /dev/null +++ b/SushiBar/SushiBarModels/Models/ISushiModel.cs @@ -0,0 +1,9 @@ +namespace SushiBarDataModels.Models +{ + public interface ISushiModel : IId + { + string SushiName { get; } + double Price { get; } + Dictionary<int, (IComponentModel, int)> SushiComponents { get; } + } +}