diff --git a/SushiBar/SushiBar.sln b/SushiBar/SushiBar.sln index bb3b28d..a7abd5b 100644 --- a/SushiBar/SushiBar.sln +++ b/SushiBar/SushiBar.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{CF80CDC9-4579-4A90-B1E0-3929F0DFB872}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{EED78058-8732-4C80-8D47-6E190EB80952}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {CF80CDC9-4579-4A90-B1E0-3929F0DFB872}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF80CDC9-4579-4A90-B1E0-3929F0DFB872}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF80CDC9-4579-4A90-B1E0-3929F0DFB872}.Release|Any CPU.Build.0 = Release|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EED78058-8732-4C80-8D47-6E190EB80952}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..07d1170 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,16 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BindingModels +{ + public class ComponentBindingModel : IComponentModel + { + public int Id { get; set; } + public string ComponentName { get; set; } = string.Empty; + public double Cost { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..42f4f98 --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,22 @@ +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public int SushiId { get; set; } + public int Count { get; set; } + public double Sum { get; set; } + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + public DateTime DateCreate { get; set; } = DateTime.Now; + public DateTime? DateImplement { get; set; } + } + +} diff --git a/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs new file mode 100644 index 0000000..795bcbd --- /dev/null +++ b/SushiBar/SushiBarContracts/BindingModels/SushiBindingModel.cs @@ -0,0 +1,21 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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 SushiComponents + { + get; + set; + } = new(); + } +} diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs new file mode 100644 index 0000000..2422874 --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IComponentLogic.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + 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/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs new file mode 100644 index 0000000..a73972c --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/IOrderLogic.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + public interface IOrderLogic + { + List? ReadList(OrderSearchModel? model); + bool CreateOrder(OrderBindingModel model); + bool TakeOrderInWork(OrderBindingModel model); + bool FinishOrder(OrderBindingModel model); + bool DeliveryOrder(OrderBindingModel model); + } + +} diff --git a/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs new file mode 100644 index 0000000..32c732b --- /dev/null +++ b/SushiBar/SushiBarContracts/BusinessLogicsContracts/ISushiLogic.cs @@ -0,0 +1,21 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.BusinessLogicsContracts +{ + public interface ISushiLogic + { + List? 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/ComponentSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs new file mode 100644 index 0000000..a69687d --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/ComponentSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModels +{ + public class ComponentSearchModel + { + public int? Id { get; set; } + public string? ComponentName { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs new file mode 100644 index 0000000..fdf186f --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModels +{ + public class OrderSearchModel + { + public int? Id { get; set; } + } + +} diff --git a/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs new file mode 100644 index 0000000..95d2732 --- /dev/null +++ b/SushiBar/SushiBarContracts/SearchModels/SushiSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.SearchModels +{ + public class SushiSearchModel + { + public int? Id { get; set; } + public string? SushiName { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs new file mode 100644 index 0000000..2ab6e9c --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/IComponentStorage.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.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/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs new file mode 100644 index 0000000..5d310e8 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/IOrderStorage.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.StoragesContracts +{ + public interface IOrderStorage + { + List GetFullList(); + List GetFilteredList(OrderSearchModel model); + OrderViewModel? GetElement(OrderSearchModel model); + OrderViewModel? Insert(OrderBindingModel model); + OrderViewModel? Update(OrderBindingModel model); + OrderViewModel? Delete(OrderBindingModel model); + } + +} diff --git a/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs new file mode 100644 index 0000000..4aab129 --- /dev/null +++ b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs @@ -0,0 +1,22 @@ +using SushiBarContracts.BindingModels; +using SushiBarContracts.SearchModels; +using SushiBarContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.StoragesContracts +{ + public interface ISushiStorage + { + List GetFullList(); + List GetFilteredList(SushiSearchModel model); + SushiViewModel? GetElement(SushiSearchModel model); + SushiViewModel? Insert(SushiBindingModel model); + SushiViewModel? Update(SushiBindingModel model); + SushiViewModel? Delete(SushiBindingModel model); + } + +} diff --git a/SushiBar/SushiBarContracts/SushiBarContracts.csproj b/SushiBar/SushiBarContracts/SushiBarContracts.csproj new file mode 100644 index 0000000..ef52534 --- /dev/null +++ b/SushiBar/SushiBarContracts/SushiBarContracts.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs new file mode 100644 index 0000000..3d112ef --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/ComponentViewModel.cs @@ -0,0 +1,20 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.ViewModels +{ + public class ComponentViewModel : IComponentModel + { + public int Id { get; set; } + [DisplayName("Название компонента")] + public string ComponentName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Cost { get; set; } + } + +} diff --git a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs new file mode 100644 index 0000000..ec4c5a3 --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -0,0 +1,30 @@ +using SushiBarDataModels.Enums; +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.ViewModels +{ + public class OrderViewModel : IOrderModel + { + [DisplayName("Номер")] + public int Id { get; set; } + public int SushiId { get; set; } + [DisplayName("Изделие")] + public string SushiName { get; set; } = string.Empty; + [DisplayName("Количество")] + public int Count { get; set; } + [DisplayName("Сумма")] + public double Sum { get; set; } + [DisplayName("Статус")] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + [DisplayName("Дата создания")] + public DateTime DateCreate { get; set; } = DateTime.Now; + [DisplayName("Дата выполнения")] + public DateTime? DateImplement { get; set; } + } +} diff --git a/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs new file mode 100644 index 0000000..2463a83 --- /dev/null +++ b/SushiBar/SushiBarContracts/ViewModels/SushiViewModel.cs @@ -0,0 +1,24 @@ +using SushiBarDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarContracts.ViewModels +{ + public class SushiViewModel : ISushiModel + { + public int Id { get; set; } + [DisplayName("Название изделия")] + public string SushiName { get; set; } = string.Empty; + [DisplayName("Цена")] + public double Price { get; set; } + public Dictionary SushiComponents + { + get; + set; + } = new(); + } +} diff --git a/SushiBar/SushiBarDataModels/IComponentModel.cs b/SushiBar/SushiBarDataModels/IComponentModel.cs index d218171..f0cba33 100644 --- a/SushiBar/SushiBarDataModels/IComponentModel.cs +++ b/SushiBar/SushiBarDataModels/IComponentModel.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SushiBarDataModels +namespace SushiBarDataModels.Models { public interface IComponentModel : IId { diff --git a/SushiBar/SushiBarDataModels/IOrderModel.cs b/SushiBar/SushiBarDataModels/IOrderModel.cs index 7f16a72..38a66b1 100644 --- a/SushiBar/SushiBarDataModels/IOrderModel.cs +++ b/SushiBar/SushiBarDataModels/IOrderModel.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SushiBarDataModels +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/SushiBarDataModels/IProductModel.cs b/SushiBar/SushiBarDataModels/IProductModel.cs deleted file mode 100644 index 2950ba4..0000000 --- a/SushiBar/SushiBarDataModels/IProductModel.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SushiBarDataModels -{ - public interface IProductModel : IId - { - string ProductName { get; } - double Price { get; } - Dictionary ProductComponents { get; } - } - -} diff --git a/SushiBar/SushiBarDataModels/ISushiModel.cs b/SushiBar/SushiBarDataModels/ISushiModel.cs new file mode 100644 index 0000000..e7ed3a3 --- /dev/null +++ b/SushiBar/SushiBarDataModels/ISushiModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SushiBarDataModels.Models +{ + public interface ISushiModel : IId + { + string SushiName { get; } + double Price { get; } + Dictionary SushiComponents { get; } + } + +}