diff --git a/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs b/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs new file mode 100644 index 0000000..956cc7d --- /dev/null +++ b/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs @@ -0,0 +1,19 @@ +using ComputerShopDataModels.Models; + +namespace ComputerShopContracts.BindingModels +{ + public class AssemblyBindingModel : IAssemblyModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string AssemblyName { get; set; } = string.Empty; + + public double Cost { get; set; } + + public string Category { get; set; } = string.Empty; + + public Dictionary AssemblyComponents { get; set; } = new(); + } +} diff --git a/ComputerShopContracts/BindingModels/ComponentBindingModel.cs b/ComputerShopContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..18844a8 --- /dev/null +++ b/ComputerShopContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,15 @@ +using ComputerShopDataModels.Models; + +namespace ComputerShopContracts.BindingModels +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string ComponentName { get; set; } = string.Empty; + + public double Cost { get; set; } + } +} diff --git a/ComputerShopContracts/BindingModels/ProductBindingModel.cs b/ComputerShopContracts/BindingModels/ProductBindingModel.cs new file mode 100644 index 0000000..18856cd --- /dev/null +++ b/ComputerShopContracts/BindingModels/ProductBindingModel.cs @@ -0,0 +1,21 @@ +using ComputerShopDataModels.Models; + +namespace ComputerShopContracts.BindingModels +{ + public class ProductBindingModel : IProductModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + public string ProductName { get; set; } = string.Empty; + + public double Cost { get; set; } + + public int Warranty { get; set; } + + public Dictionary ProductComponents { get; set; } = new(); + + public int? ShipmentId { get; set; } + } +} diff --git a/ComputerShopContracts/BusinessLogicContracts/IAssemblyLogic.cs b/ComputerShopContracts/BusinessLogicContracts/IAssemblyLogic.cs new file mode 100644 index 0000000..3ac85ca --- /dev/null +++ b/ComputerShopContracts/BusinessLogicContracts/IAssemblyLogic.cs @@ -0,0 +1,19 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; + +namespace ComputerShopContracts.BusinessLogicContracts +{ + public interface IAssemblyLogic + { + List? ReadList(AssemblySearchModel? Model); + + AssemblyViewModel? ReadElement(AssemblySearchModel Model); + + bool Create(AssemblyBindingModel Model); + + bool Update(AssemblyBindingModel Model); + + bool Delete(AssemblyBindingModel Model); + } +} diff --git a/ComputerShopContracts/BusinessLogicContracts/IComponentLogic.cs b/ComputerShopContracts/BusinessLogicContracts/IComponentLogic.cs new file mode 100644 index 0000000..0c50bb1 --- /dev/null +++ b/ComputerShopContracts/BusinessLogicContracts/IComponentLogic.cs @@ -0,0 +1,19 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; + +namespace ComputerShopContracts.BusinessLogicContracts +{ + public interface IComponentLogic + { + List? ReadList(ComponentSearchModel? Model); + + ComponentViewModel? ReadElement(ComponentSearchModel Model); + + bool Create(ComponentBindingModel Model); + + bool Update(ComponentBindingModel Model); + + bool Delete(ComponentBindingModel Model); + } +} diff --git a/ComputerShopContracts/BusinessLogicContracts/IProductLogic.cs b/ComputerShopContracts/BusinessLogicContracts/IProductLogic.cs new file mode 100644 index 0000000..005a7fa --- /dev/null +++ b/ComputerShopContracts/BusinessLogicContracts/IProductLogic.cs @@ -0,0 +1,19 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; + +namespace ComputerShopContracts.BusinessLogicContracts +{ + public interface IProductLogic + { + List? ReadList(ProductSearchModel? Model); + + ProductViewModel? ReadElement(ProductSearchModel Model); + + bool Create(ProductBindingModel Model); + + bool Update(ProductBindingModel Model); + + bool Delete(ProductBindingModel Model); + } +} diff --git a/ComputerShopContracts/SearchModels/AssemblySearchModel.cs b/ComputerShopContracts/SearchModels/AssemblySearchModel.cs new file mode 100644 index 0000000..c15871b --- /dev/null +++ b/ComputerShopContracts/SearchModels/AssemblySearchModel.cs @@ -0,0 +1,11 @@ +namespace ComputerShopContracts.SearchModels +{ + public class AssemblySearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + + public string? Category { get; set; } + } +} diff --git a/ComputerShopContracts/SearchModels/ComponentSearchModel.cs b/ComputerShopContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..3a4bb83 --- /dev/null +++ b/ComputerShopContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,9 @@ +namespace ComputerShopContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + } +} diff --git a/ComputerShopContracts/SearchModels/ProductSearchModel.cs b/ComputerShopContracts/SearchModels/ProductSearchModel.cs new file mode 100644 index 0000000..60e81eb --- /dev/null +++ b/ComputerShopContracts/SearchModels/ProductSearchModel.cs @@ -0,0 +1,11 @@ +namespace ComputerShopContracts.SearchModels +{ + public class ProductSearchModel + { + public int? Id { get; set; } + + public int? UserId { get; set; } + + public int? ShipmentId { get; set; } + } +} diff --git a/ComputerShopContracts/StorageContracts/IAssemblyStorage.cs b/ComputerShopContracts/StorageContracts/IAssemblyStorage.cs new file mode 100644 index 0000000..4fde22e --- /dev/null +++ b/ComputerShopContracts/StorageContracts/IAssemblyStorage.cs @@ -0,0 +1,21 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; + +namespace ComputerShopContracts.StorageContracts +{ + public interface IAssemblyStorage + { + List GetFullList(); + + List GetFilteredList(AssemblySearchModel Model); + + AssemblyViewModel? GetElement(AssemblySearchModel Model); + + AssemblyViewModel? Insert(AssemblyBindingModel Model); + + AssemblyViewModel? Update(AssemblyBindingModel Model); + + AssemblyViewModel? Delete(AssemblyBindingModel Model); + } +} diff --git a/ComputerShopContracts/StorageContracts/IComponentStorage.cs b/ComputerShopContracts/StorageContracts/IComponentStorage.cs new file mode 100644 index 0000000..e0b7ed6 --- /dev/null +++ b/ComputerShopContracts/StorageContracts/IComponentStorage.cs @@ -0,0 +1,21 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; + +namespace ComputerShopContracts.StorageContracts +{ + 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/ComputerShopContracts/StorageContracts/IProductStorage.cs b/ComputerShopContracts/StorageContracts/IProductStorage.cs new file mode 100644 index 0000000..ca151af --- /dev/null +++ b/ComputerShopContracts/StorageContracts/IProductStorage.cs @@ -0,0 +1,21 @@ +using ComputerShopContracts.BindingModels; +using ComputerShopContracts.SearchModels; +using ComputerShopContracts.ViewModels; + +namespace ComputerShopContracts.StorageContracts +{ + 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/ComputerShopContracts/ViewModels/AssemblyViewModel.cs b/ComputerShopContracts/ViewModels/AssemblyViewModel.cs new file mode 100644 index 0000000..27ef688 --- /dev/null +++ b/ComputerShopContracts/ViewModels/AssemblyViewModel.cs @@ -0,0 +1,23 @@ +using ComputerShopDataModels.Models; +using System.ComponentModel; + +namespace ComputerShopContracts.ViewModels +{ + public class AssemblyViewModel : IAssemblyModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + [DisplayName("Название сборки")] + public string AssemblyName { get; set; } = string.Empty; + + [DisplayName("Стоимость")] + public double Cost { get; set; } + + [DisplayName("Категория")] + public string Category { get; set; } = string.Empty; + + public Dictionary AssemblyComponents { get; set; } = new(); + } +} diff --git a/ComputerShopContracts/ViewModels/ComponentViewModel.cs b/ComputerShopContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..cb38f51 --- /dev/null +++ b/ComputerShopContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,18 @@ +using ComputerShopDataModels.Models; +using System.ComponentModel; + +namespace ComputerShopContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id { get; set; } + + public int UserId { get; } + + [DisplayName("Название комплектующей")] + public string ComponentName { get; } = string.Empty; + + [DisplayName("Стоимость")] + public double Cost { get; } + } +} diff --git a/ComputerShopContracts/ViewModels/ProductViewModel.cs b/ComputerShopContracts/ViewModels/ProductViewModel.cs new file mode 100644 index 0000000..88577f0 --- /dev/null +++ b/ComputerShopContracts/ViewModels/ProductViewModel.cs @@ -0,0 +1,28 @@ +using ComputerShopDataModels.Models; +using System.ComponentModel; + +namespace ComputerShopContracts.ViewModels +{ + public class ProductViewModel : IProductModel + { + public int Id { get; set; } + + public int UserId { get; set; } + + [DisplayName("Название товара")] + public string ProductName { get; set; } = string.Empty; + + [DisplayName("Стоимость")] + public double Cost { get; set; } + + [DisplayName("Гарантия (мес.)")] + public int Warranty { get; set; } + + public Dictionary ProductComponents { get; set; } = new(); + + public int? ShipmentId { get; set; } + + [DisplayName("Поставщик")] + public string ProviderName { get; set; } = string.Empty; + } +}