From e70c5bfc06bc235aa81e33555acdb27d6245bc67 Mon Sep 17 00:00:00 2001 From: Pyro <732603@gmail.com> Date: Fri, 29 Nov 2024 07:09:24 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D1=83?= =?UTF-8?q?=D1=80=D0=B0=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectConfectionaryFactory/Entities/Order.cs | 6 ++++-- .../ProjectConfectionaryFactory/Entities/Product.cs | 8 +++++--- .../{ComponentProduct.cs => ProductComponent.cs} | 10 +++++----- .../ProjectConfectionaryFactory/Entities/Supply.cs | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) rename ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/{ComponentProduct.cs => ProductComponent.cs} (67%) diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Order.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Order.cs index c58c505..92d8034 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Order.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Order.cs @@ -6,15 +6,17 @@ public class Order public int ClientId { get; private set; } public bool Completed { get; private set; } public DateTime Date { get; private set; } + public IEnumerable OrderProducts { get; private set; } = []; - public static Order CreateEntity(int id, int clientid, bool completed) + public static Order CreateOperation(int id, int clientid, bool completed, IEnumerable orderProducts) { return new Order { Id = id, ClientId = clientid, Completed = completed, - Date = DateTime.Now + Date = DateTime.Now, + OrderProducts = orderProducts }; } } diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Product.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Product.cs index 65405b3..ac9629e 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Product.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Product.cs @@ -8,15 +8,17 @@ public class Product public ConfectionaryType ConfectionaryType { get; private set; } public string Name { get; private set; } = string.Empty; public double Price { get; private set; } - - public static Product CreateEntity(int id, ConfectionaryType сonfectionaryType, string name, double price) + public IEnumerable ProductComponents { get; private set; } = []; + + public static Product CreateEntity(int id, ConfectionaryType сonfectionaryType, string name, double price, IEnumerable productComponents) { return new Product { Id = id, ConfectionaryType = сonfectionaryType, Name = name ?? string.Empty, - Price = price + Price = price, + ProductComponents = productComponents }; } } diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/ComponentProduct.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/ProductComponent.cs similarity index 67% rename from ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/ComponentProduct.cs rename to ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/ProductComponent.cs index 8e249b3..3a56469 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/ComponentProduct.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/ProductComponent.cs @@ -1,17 +1,17 @@ namespace ProjectConfectionaryFactory.Entities; -public class ComponentProduct +public class ProductComponent { - public int ComponentId { get; private set; } public int ProductId { get; private set; } + public int ComponentId { get; private set; } public double Weight { get; private set; } - public static ComponentProduct CreateEntity(int componentid, int productid, double weight) + public static ProductComponent CreateEntity(int productid, int componentid, double weight) { - return new ComponentProduct + return new ProductComponent { - ComponentId = componentid, ProductId = productid, + ComponentId = componentid, Weight = weight }; } diff --git a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supply.cs b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supply.cs index 51d9893..b87e644 100644 --- a/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supply.cs +++ b/ProjectConfectionaryFactory/ProjectConfectionaryFactory/Entities/Supply.cs @@ -9,7 +9,7 @@ public class Supply public bool Completed { get; private set; } public DateTime Date { get; private set; } - public static Supply CreateEntity(int id, int supplierid, int componentid, double weight, bool completed) + public static Supply CreateOperation(int id, int supplierid, int componentid, double weight, bool completed) { return new Supply {