Исправлена структура сущностей
This commit is contained in:
parent
da841c1083
commit
e70c5bfc06
@ -6,15 +6,17 @@ public class Order
|
|||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
public bool Completed { get; private set; }
|
public bool Completed { get; private set; }
|
||||||
public DateTime Date { get; private set; }
|
public DateTime Date { get; private set; }
|
||||||
|
public IEnumerable<OrderProduct> 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<OrderProduct> orderProducts)
|
||||||
{
|
{
|
||||||
return new Order
|
return new Order
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
ClientId = clientid,
|
ClientId = clientid,
|
||||||
Completed = completed,
|
Completed = completed,
|
||||||
Date = DateTime.Now
|
Date = DateTime.Now,
|
||||||
|
OrderProducts = orderProducts
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,17 @@ public class Product
|
|||||||
public ConfectionaryType ConfectionaryType { get; private set; }
|
public ConfectionaryType ConfectionaryType { get; private set; }
|
||||||
public string Name { get; private set; } = string.Empty;
|
public string Name { get; private set; } = string.Empty;
|
||||||
public double Price { get; private set; }
|
public double Price { get; private set; }
|
||||||
|
public IEnumerable<ProductComponent> ProductComponents { get; private set; } = [];
|
||||||
|
|
||||||
public static Product CreateEntity(int id, ConfectionaryType сonfectionaryType, string name, double price)
|
public static Product CreateEntity(int id, ConfectionaryType сonfectionaryType, string name, double price, IEnumerable<ProductComponent> productComponents)
|
||||||
{
|
{
|
||||||
return new Product
|
return new Product
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
ConfectionaryType = сonfectionaryType,
|
ConfectionaryType = сonfectionaryType,
|
||||||
Name = name ?? string.Empty,
|
Name = name ?? string.Empty,
|
||||||
Price = price
|
Price = price,
|
||||||
|
ProductComponents = productComponents
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
namespace ProjectConfectionaryFactory.Entities;
|
namespace ProjectConfectionaryFactory.Entities;
|
||||||
|
|
||||||
public class ComponentProduct
|
public class ProductComponent
|
||||||
{
|
{
|
||||||
public int ComponentId { get; private set; }
|
|
||||||
public int ProductId { get; private set; }
|
public int ProductId { get; private set; }
|
||||||
|
public int ComponentId { get; private set; }
|
||||||
public double Weight { 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,
|
ProductId = productid,
|
||||||
|
ComponentId = componentid,
|
||||||
Weight = weight
|
Weight = weight
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ public class Supply
|
|||||||
public bool Completed { get; private set; }
|
public bool Completed { get; private set; }
|
||||||
public DateTime Date { 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
|
return new Supply
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user