Создание перечисления, сущностей-операций и сущностей-связей многих ко многим

This commit is contained in:
Pyro 2024-11-14 18:14:07 +04:00
parent a52f8193a0
commit 367073709c
5 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,18 @@
namespace ProjectConfectionaryFactory.Entities;
public class ComponentProduct
{
public int ComponentId { get; private set; }
public int ProductId { get; private set; }
public double Weight { get; private set; }
public static ComponentProduct CreateEntity(int componentid, int productid, double weight)
{
return new ComponentProduct
{
ComponentId = componentid,
ProductId = productid,
Weight = weight
};
}
}

View File

@ -0,0 +1,11 @@
namespace ProjectConfectionaryFactory.Entities.Enums;
[Flags]
public enum ConfectionaryType
{
None = 0,
Cake = 1,
Roll = 2,
Cupcake = 4,
Cookie = 8
}

View File

@ -0,0 +1,20 @@
namespace ProjectConfectionaryFactory.Entities;
public class Order
{
public int Id { get; private set; }
public int ClientId { get; private set; }
public bool Completed { get; private set; }
public DateTime Date { get; private set; }
public static Order CreateEntity(int id, int clientid, bool completed)
{
return new Order
{
Id = id,
ClientId = clientid,
Completed = completed,
Date = DateTime.Now
};
}
}

View File

@ -0,0 +1,18 @@
namespace ProjectConfectionaryFactory.Entities;
public class OrderProduct
{
public int OrderId { get; private set; }
public int ProductId { get; private set; }
public int Count { get; private set; }
public static OrderProduct CreateEntity(int orderid, int productid, int count)
{
return new OrderProduct
{
OrderId = orderid,
ProductId = productid,
Count = count
};
}
}

View File

@ -0,0 +1,22 @@
namespace ProjectConfectionaryFactory.Entities;
public class Supply
{
public int Id { get; private set; }
public int SupplierId { get; private set; }
public int ComponentId { get; private set; }
public double Weight { get; private set; }
public DateTime Date { get; private set; }
public static Supply CreateEntity(int id, int supplierid, int componentid, double weight)
{
return new Supply
{
Id = id,
SupplierId = supplierid,
ComponentId = componentid,
Weight = weight,
Date = DateTime.Now
};
}
}