From 3263e19af1fd5ad7e0ea7226adb52c47fcfd5aee Mon Sep 17 00:00:00 2001 From: malimova Date: Thu, 15 Feb 2024 22:44:30 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20BindingModels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Confectionery/Confectionery.sln | 10 +++++++-- .../BindingModels/ComponentBindingModel.cs | 16 ++++++++++++++ .../BindingModels/OrderBindingModel.cs | 21 +++++++++++++++++++ .../BindingModels/PastryBindingModel.cs | 17 +++++++++++++++ .../Class1.cs | 2 +- .../ConfectioneryContracts.csproj | 20 ++++++++++++++++++ .../ConfectioneryDataModels/IOrderModel.cs | 2 +- .../ConfectioneryDataModels/IPastryModel.cs | 4 ++-- 8 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 Confectionery/ConfectioneryContracts/BindingModels/ComponentBindingModel.cs create mode 100644 Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs create mode 100644 Confectionery/ConfectioneryContracts/BindingModels/PastryBindingModel.cs rename Confectionery/{ConfectioneryDataModels => ConfectioneryContracts}/Class1.cs (50%) create mode 100644 Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj diff --git a/Confectionery/Confectionery.sln b/Confectionery/Confectionery.sln index d36799f..e0c039f 100644 --- a/Confectionery/Confectionery.sln +++ b/Confectionery/Confectionery.sln @@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33424.131 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Confectionery", "Confectionery\Confectionery.csproj", "{3FBA3531-D080-42B2-869B-AF42CCF9C770}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Confectionery", "Confectionery\Confectionery.csproj", "{3FBA3531-D080-42B2-869B-AF42CCF9C770}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfectioneryDataModels", "ConfectioneryDataModels\ConfectioneryDataModels.csproj", "{B1066AB3-A781-49D8-9629-DAEEB7AEB926}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfectioneryDataModels", "ConfectioneryDataModels\ConfectioneryDataModels.csproj", "{B1066AB3-A781-49D8-9629-DAEEB7AEB926}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfectioneryContracts", "ConfectioneryContracts\ConfectioneryContracts.csproj", "{6FFC8BF0-172F-4A99-AF4E-8FCEC210FF36}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,10 @@ Global {B1066AB3-A781-49D8-9629-DAEEB7AEB926}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1066AB3-A781-49D8-9629-DAEEB7AEB926}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1066AB3-A781-49D8-9629-DAEEB7AEB926}.Release|Any CPU.Build.0 = Release|Any CPU + {6FFC8BF0-172F-4A99-AF4E-8FCEC210FF36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FFC8BF0-172F-4A99-AF4E-8FCEC210FF36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FFC8BF0-172F-4A99-AF4E-8FCEC210FF36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FFC8BF0-172F-4A99-AF4E-8FCEC210FF36}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Confectionery/ConfectioneryContracts/BindingModels/ComponentBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/ComponentBindingModel.cs new file mode 100644 index 0000000..2f91b81 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/BindingModels/ComponentBindingModel.cs @@ -0,0 +1,16 @@ +using ConfectioneryDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.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/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs new file mode 100644 index 0000000..8262c80 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/BindingModels/OrderBindingModel.cs @@ -0,0 +1,21 @@ +using ConfectioneryDataModels.Enums; +using ConfectioneryDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.BindingModels +{ + public class OrderBindingModel : IOrderModel + { + public int Id { get; set; } + public int PastryId { 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/Confectionery/ConfectioneryContracts/BindingModels/PastryBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/PastryBindingModel.cs new file mode 100644 index 0000000..f293a19 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/BindingModels/PastryBindingModel.cs @@ -0,0 +1,17 @@ +using ConfectioneryDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryContracts.BindingModels +{ + public class PastryBindingModel : IPastryModel + { + public int Id { get; set; } + public string PastryName { get; set; } = string.Empty; + public double Price { get; set; } + public Dictionary PastryComponents { get; set; } = new(); + } +} diff --git a/Confectionery/ConfectioneryDataModels/Class1.cs b/Confectionery/ConfectioneryContracts/Class1.cs similarity index 50% rename from Confectionery/ConfectioneryDataModels/Class1.cs rename to Confectionery/ConfectioneryContracts/Class1.cs index 84cdc69..0dcf35f 100644 --- a/Confectionery/ConfectioneryDataModels/Class1.cs +++ b/Confectionery/ConfectioneryContracts/Class1.cs @@ -1,4 +1,4 @@ -namespace ConfectioneryDataModels +namespace ConfectioneryContracts { public class Class1 { diff --git a/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj b/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj new file mode 100644 index 0000000..94665f9 --- /dev/null +++ b/Confectionery/ConfectioneryContracts/ConfectioneryContracts.csproj @@ -0,0 +1,20 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + diff --git a/Confectionery/ConfectioneryDataModels/IOrderModel.cs b/Confectionery/ConfectioneryDataModels/IOrderModel.cs index 3eed2d5..40e889f 100644 --- a/Confectionery/ConfectioneryDataModels/IOrderModel.cs +++ b/Confectionery/ConfectioneryDataModels/IOrderModel.cs @@ -9,7 +9,7 @@ namespace ConfectioneryDataModels.Models { public interface IOrderModel : IId { - int ProductId { get; } + int PastryId { get; } int Count { get; } double Sum { get; } OrderStatus Status { get; } diff --git a/Confectionery/ConfectioneryDataModels/IPastryModel.cs b/Confectionery/ConfectioneryDataModels/IPastryModel.cs index 2f91f56..004216d 100644 --- a/Confectionery/ConfectioneryDataModels/IPastryModel.cs +++ b/Confectionery/ConfectioneryDataModels/IPastryModel.cs @@ -6,10 +6,10 @@ using System.Threading.Tasks; namespace ConfectioneryDataModels.Models { - internal interface IPastryModel : IId + public interface IPastryModel : IId { string PastryName { get; } double Price { get; } - Dictionary ProductComponents { get; } + Dictionary PastryComponents { get; } } }