Изменение названий в проекте Contracts.

This commit is contained in:
Programmist73 2023-02-10 12:29:17 +04:00
parent 950263a842
commit fa5a6c35b7
14 changed files with 97 additions and 97 deletions

View File

@ -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<ComponentLogic> logger, IComponentStorage componentStorage)
public ComponentLogic(ILogger<ComponentLogic> logger, IWorkPieceStorage componentStorage)
{
_logger = logger;
_componentStorage = componentStorage;
}
//вывод отфильтрованного списка компонентов
public List<ComponentViewModel>? ReadList(ComponentSearchModel? model)
public List<WorkPieceViewModel>? 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,
});

View File

@ -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<ProductLogic> logger, IProductStorage productStorage)
public ProductLogic(ILogger<ProductLogic> logger, IArticleStorage productStorage)
{
_logger = logger;
_productStorage = productStorage;
}
//вывод отфильтрованного списка
public List<ProductViewModel>? ReadList(ProductSearchModel? model)
public List<ArticleViewModel>? 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,
});

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.BindingModels
{
//реализация сущности "Продукт"
public class ProductBindingModel : IArticleModel
public class ArticleBindingModel : IArticleModel
{
public int Id { get; set; }

View File

@ -8,7 +8,7 @@ using BlacksmithWorkshopDataModels.Models;
namespace BlacksmithWorkshopContracts.BindingModels
{
//реализация сущности "Компонент"
public class ComponentBindingModel : IWorkPieceModel
public class WorkPieceBindingModel : IWorkPieceModel
{
public int Id { get; set; }

View File

@ -10,16 +10,16 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
{
//бизнес-логика для продуктов
public interface IProductLogic
public interface IArticleLogic
{
List<ProductViewModel>? ReadList(ProductSearchModel? model);
List<ArticleViewModel>? 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);
}
}

View File

@ -10,16 +10,16 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
{
//бизнес-логика для компонентов
public interface IComponentLogic
public interface IWorkPieceLogic
{
List<ComponentViewModel>? ReadList(ComponentSearchModel? model);
List<WorkPieceViewModel>? 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);
}
}

View File

@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.SearchModels
{
//модель для поиска компонента "Продукт"
public class ProductSearchModel
//модель для поиска компонента "Продукт" (она же изделие)
public class ArticleSearchModel
{
//для поиска по идентификатору
public int? Id { get; set; }

View File

@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.SearchModels
{
//модель для поиска сущности "Компонент"
public class ComponentSearchModel
//модель для поиска сущности "Компонент" (она же заготовка)
public class WorkPieceSearchModel
{
//для поиска по идентификатору
public int? Id { get; set; }

View File

@ -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<ArticleViewModel> GetFullList();
List<ArticleViewModel> GetFilteredList(ArticleSearchModel model);
ArticleViewModel? GetElement(ArticleSearchModel model);
ArticleViewModel? Insert(ArticleBindingModel model);
ArticleViewModel? Update(ArticleBindingModel model);
ArticleViewModel? Delete(ArticleBindingModel model);
}
}

View File

@ -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<ComponentViewModel> GetFullList();
List<ComponentViewModel> GetFilteredList(ComponentSearchModel model);
ComponentViewModel? GetElement(ComponentSearchModel model);
ComponentViewModel? Insert(ComponentBindingModel model);
ComponentViewModel? Update(ComponentBindingModel model);
ComponentViewModel? Delete(ComponentBindingModel model);
}
}

View File

@ -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<ProductViewModel> GetFullList();
List<ProductViewModel> GetFilteredList(ProductSearchModel model);
ProductViewModel? GetElement(ProductSearchModel model);
ProductViewModel? Insert(ProductBindingModel model);
ProductViewModel? Update(ProductBindingModel model);
ProductViewModel? Delete(ProductBindingModel model);
}
}

View File

@ -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<WorkPieceViewModel> GetFullList();
List<WorkPieceViewModel> GetFilteredList(WorkPieceSearchModel model);
WorkPieceViewModel? GetElement(WorkPieceSearchModel model);
WorkPieceViewModel? Insert(WorkPieceBindingModel model);
WorkPieceViewModel? Update(WorkPieceBindingModel model);
WorkPieceViewModel? Delete(WorkPieceBindingModel model);
}
}

View File

@ -8,8 +8,8 @@ using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.ViewModels
{
//класс для отображения пользователю информаци о продуктах
public class ProductViewModel : IArticleModel
//класс для отображения пользователю информаци о продуктах (изделиях)
public class ArticleViewModel : IArticleModel
{
public int Id { get; set; }

View File

@ -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("Цена")]