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 {