diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs index 9a73fda..a8bdd07 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ComponentLogic.cs @@ -13,21 +13,21 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopBusinessLogic.BusinessLogic { //класс, реализующий логику для компонентов - public class ComponentLogic : IComponentLogic + public class ComponentLogic : IWorkPieceLogic { private readonly ILogger _logger; - private readonly IComponentStorage _componentStorage; + private readonly IWorkPieceStorage _componentStorage; //конструктор - public ComponentLogic(ILogger logger, IComponentStorage componentStorage) + public ComponentLogic(ILogger logger, IWorkPieceStorage componentStorage) { _logger = logger; _componentStorage = componentStorage; } //вывод отфильтрованного списка компонентов - public List? ReadList(ComponentSearchModel? model) + public List? ReadList(WorkPieceSearchModel? model) { _logger.LogInformation("ReadList. WorkPieceName:{WorkPieceName}. Id:{Id}", model?.WorkPieceName, model?.Id); @@ -46,7 +46,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //вывод конкретного компонента - public ComponentViewModel? ReadElement(ComponentSearchModel model) + public WorkPieceViewModel? ReadElement(WorkPieceSearchModel model) { if(model == null) { @@ -69,7 +69,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //создание компонента - public bool Create(ComponentBindingModel model) + public bool Create(WorkPieceBindingModel model) { CheckModel(model); @@ -83,7 +83,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //обновление компонента - public bool Update(ComponentBindingModel model) + public bool Update(WorkPieceBindingModel model) { CheckModel(model); @@ -97,7 +97,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //удаление компонента - public bool Delete(ComponentBindingModel model) + public bool Delete(WorkPieceBindingModel model) { CheckModel(model); @@ -111,7 +111,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //проверка входного аргумента для методов Insert, Update и Delete - private void CheckModel(ComponentBindingModel model, bool withParams = true) + private void CheckModel(WorkPieceBindingModel model, bool withParams = true) { if(model == null) { @@ -139,7 +139,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic model.WorkPieceName, model.Cost, model.Id); //проверка на наличие такого же компонента в списке - var element = _componentStorage.GetElement(new ComponentSearchModel + var element = _componentStorage.GetElement(new WorkPieceSearchModel { WorkPieceName = model.WorkPieceName, }); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs index b885924..6ad6b30 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ProductLogic.cs @@ -12,21 +12,21 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopBusinessLogic.BusinessLogic { - internal class ProductLogic : IProductLogic + internal class ProductLogic : IArticleLogic { private readonly ILogger _logger; - private readonly IProductStorage _productStorage; + private readonly IArticleStorage _productStorage; //конструктор - public ProductLogic(ILogger logger, IProductStorage productStorage) + public ProductLogic(ILogger logger, IArticleStorage productStorage) { _logger = logger; _productStorage = productStorage; } //вывод отфильтрованного списка - public List? ReadList(ProductSearchModel? model) + public List? ReadList(ArticleSearchModel? model) { _logger.LogInformation("ReadList. ArticleName:{ArticleName}. Id:{Id}", model?.ArticleName, model?.Id); @@ -45,7 +45,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //вывод конкретного продукта - public ProductViewModel? ReadProduct(ProductSearchModel model) + public ArticleViewModel? ReadProduct(ArticleSearchModel model) { if(model == null) { @@ -68,7 +68,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //Создание продукта - public bool Create(ProductBindingModel model) + public bool Create(ArticleBindingModel model) { CheckModel(model); @@ -82,7 +82,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //обновление продукта - public bool Update(ProductBindingModel model) + public bool Update(ArticleBindingModel model) { CheckModel(model); @@ -96,7 +96,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //удаление продукта - public bool Delete(ProductBindingModel model) + public bool Delete(ArticleBindingModel model) { CheckModel(model); @@ -110,7 +110,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic } //проверка входного аргумента для методов Insert, Update и Delete - private void CheckModel(ProductBindingModel model, bool withParams = true) + private void CheckModel(ArticleBindingModel model, bool withParams = true) { if(model == null) { @@ -139,7 +139,7 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic model.ArticleName, model.Price, model.Id); //проверка на наличие такого же продукта в списке - var element = _productStorage.GetElement(new ProductSearchModel + var element = _productStorage.GetElement(new ArticleSearchModel { ArticleName = model.ArticleName, }); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ArticleBindingModel.cs similarity index 90% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ArticleBindingModel.cs index 48d689f..60334e6 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ProductBindingModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ArticleBindingModel.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.BindingModels { //реализация сущности "Продукт" - public class ProductBindingModel : IArticleModel + public class ArticleBindingModel : IArticleModel { public int Id { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/WorkPieceBindingModel.cs similarity index 88% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/WorkPieceBindingModel.cs index 9b6949f..68b53da 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/ComponentBindingModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/WorkPieceBindingModel.cs @@ -8,7 +8,7 @@ using BlacksmithWorkshopDataModels.Models; namespace BlacksmithWorkshopContracts.BindingModels { //реализация сущности "Компонент" - public class ComponentBindingModel : IWorkPieceModel + public class WorkPieceBindingModel : IWorkPieceModel { public int Id { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IProductLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IArticleLogic.cs similarity index 57% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IProductLogic.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IArticleLogic.cs index a938007..055d888 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IProductLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IArticleLogic.cs @@ -10,16 +10,16 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.BusinessLogicsContracts { //бизнес-логика для продуктов - public interface IProductLogic + public interface IArticleLogic { - List? ReadList(ProductSearchModel? model); + List? ReadList(ArticleSearchModel? model); - ProductViewModel? ReadProduct(ProductSearchModel model); + ArticleViewModel? ReadProduct(ArticleSearchModel model); - bool Create(ProductBindingModel model); + bool Create(ArticleBindingModel model); - bool Update(ProductBindingModel model); + bool Update(ArticleBindingModel model); - bool Delete(ProductBindingModel model); + bool Delete(ArticleBindingModel model); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkPieceLogic.cs similarity index 57% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkPieceLogic.cs index abd282a..2aad689 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IComponentLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IWorkPieceLogic.cs @@ -10,16 +10,16 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.BusinessLogicsContracts { //бизнес-логика для компонентов - public interface IComponentLogic + public interface IWorkPieceLogic { - List? ReadList(ComponentSearchModel? model); + List? ReadList(WorkPieceSearchModel? model); - ComponentViewModel? ReadElement(ComponentSearchModel model); + WorkPieceViewModel? ReadElement(WorkPieceSearchModel model); - bool Create(ComponentBindingModel model); + bool Create(WorkPieceBindingModel model); - bool Update(ComponentBindingModel model); + bool Update(WorkPieceBindingModel model); - bool Delete(ComponentBindingModel model); + bool Delete(WorkPieceBindingModel model); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ArticleSearchModel.cs similarity index 85% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ArticleSearchModel.cs index 561f80b..23163cf 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ProductSearchModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ArticleSearchModel.cs @@ -6,8 +6,8 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.SearchModels { - //модель для поиска компонента "Продукт" - public class ProductSearchModel + //модель для поиска компонента "Продукт" (она же изделие) + public class ArticleSearchModel { //для поиска по идентификатору public int? Id { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/WorkPieceSearchModel.cs similarity index 84% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/WorkPieceSearchModel.cs index 302941e..45048bf 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/ComponentSearchModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/WorkPieceSearchModel.cs @@ -6,8 +6,8 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.SearchModels { - //модель для поиска сущности "Компонент" - public class ComponentSearchModel + //модель для поиска сущности "Компонент" (она же заготовка) + public class WorkPieceSearchModel { //для поиска по идентификатору public int? Id { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IArticleStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IArticleStorage.cs new file mode 100644 index 0000000..e5e47d5 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IArticleStorage.cs @@ -0,0 +1,27 @@ +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.SearchModels; +using BlacksmithWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlacksmithWorkshopContracts.StoragesContracts +{ + //класс для хранилища продуктов (изделий) + public interface IArticleStorage + { + List GetFullList(); + + List GetFilteredList(ArticleSearchModel model); + + ArticleViewModel? GetElement(ArticleSearchModel model); + + ArticleViewModel? Insert(ArticleBindingModel model); + + ArticleViewModel? Update(ArticleBindingModel model); + + ArticleViewModel? Delete(ArticleBindingModel model); + } +} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IComponentStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IComponentStorage.cs deleted file mode 100644 index de56298..0000000 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IComponentStorage.cs +++ /dev/null @@ -1,27 +0,0 @@ -using BlacksmithWorkshopContracts.BindingModels; -using BlacksmithWorkshopContracts.SearchModels; -using BlacksmithWorkshopContracts.ViewModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BlacksmithWorkshopContracts.StoragesContracts -{ - //класс хранилища компонентов - public interface IComponentStorage - { - List GetFullList(); - - List GetFilteredList(ComponentSearchModel model); - - ComponentViewModel? GetElement(ComponentSearchModel model); - - ComponentViewModel? Insert(ComponentBindingModel model); - - ComponentViewModel? Update(ComponentBindingModel model); - - ComponentViewModel? Delete(ComponentBindingModel model); - } -} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IProductStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IProductStorage.cs deleted file mode 100644 index aee63f5..0000000 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IProductStorage.cs +++ /dev/null @@ -1,27 +0,0 @@ -using BlacksmithWorkshopContracts.BindingModels; -using BlacksmithWorkshopContracts.SearchModels; -using BlacksmithWorkshopContracts.ViewModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BlacksmithWorkshopContracts.StoragesContracts -{ - //класс для хранилища продуктов - public interface IProductStorage - { - List GetFullList(); - - List GetFilteredList(ProductSearchModel model); - - ProductViewModel? GetElement(ProductSearchModel model); - - ProductViewModel? Insert(ProductBindingModel model); - - ProductViewModel? Update(ProductBindingModel model); - - ProductViewModel? Delete(ProductBindingModel model); - } -} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IWorkPieceStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IWorkPieceStorage.cs new file mode 100644 index 0000000..0b0600e --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/StoragesContracts/IWorkPieceStorage.cs @@ -0,0 +1,27 @@ +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.SearchModels; +using BlacksmithWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlacksmithWorkshopContracts.StoragesContracts +{ + //класс хранилища компонентов (заготовок) + public interface IWorkPieceStorage + { + List GetFullList(); + + List GetFilteredList(WorkPieceSearchModel model); + + WorkPieceViewModel? GetElement(WorkPieceSearchModel model); + + WorkPieceViewModel? Insert(WorkPieceBindingModel model); + + WorkPieceViewModel? Update(WorkPieceBindingModel model); + + WorkPieceViewModel? Delete(WorkPieceBindingModel model); + } +} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ArticleViewModel.cs similarity index 84% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ArticleViewModel.cs index d400fca..492114b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ProductViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ArticleViewModel.cs @@ -8,8 +8,8 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.ViewModels { - //класс для отображения пользователю информаци о продуктах - public class ProductViewModel : IArticleModel + //класс для отображения пользователю информаци о продуктах (изделиях) + public class ArticleViewModel : IArticleModel { public int Id { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs similarity index 72% rename from BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs rename to BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs index 72e1ecd..05c5e97 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/WorkPieceViewModel.cs @@ -8,12 +8,12 @@ using System.Threading.Tasks; namespace BlacksmithWorkshopContracts.ViewModels { - //класс для отображения пользователю данных о компонентах - public class ComponentViewModel : IWorkPieceModel + //класс для отображения пользователю данных о компонентах (заготовках) + public class WorkPieceViewModel : IWorkPieceModel { public int Id { get; set; } - [DisplayName("Название компонента")] + [DisplayName("Название заготовки")] public string WorkPieceName { get; set; } = string.Empty; [DisplayName("Цена")]