Error fix

This commit is contained in:
2023-05-20 08:34:33 +04:00
parent e0c39713ee
commit 4967f035d9
17 changed files with 146 additions and 85 deletions

View File

@@ -38,20 +38,6 @@ namespace ComputerShopDatabaseImplement.Models
}
private Dictionary<int, (IOrderModel, int)>? _assemblyOrders = null;
[NotMapped]
public Dictionary<int, (IOrderModel, int)> AssemblyOrders
{
get
{
if (_assemblyOrders == null)
{
_assemblyOrders = Orders
.ToDictionary(recPC => recPC.OrderId, recPC =>
(recPC.Order as IOrderModel, recPC.Count));
}
return _assemblyOrders;
}
}
[ForeignKey("AssemblyId")]
public virtual List<AssemblyComponent> Components { get; set; } = new();
[ForeignKey("AssemblyId")]
@@ -90,7 +76,6 @@ namespace ComputerShopDatabaseImplement.Models
AssemblyName = AssemblyName,
Price = Price,
AssemblyComponents = AssemblyComponents,
AssemblyOrders = AssemblyOrders,
ClientId = ClientId
};
public void UpdateComponents(ComputerShopDatabase context, AssemblyBindingModel model)

View File

@@ -22,6 +22,8 @@ namespace ComputerShopDatabaseImplement.Models
[ForeignKey("ReceivingId")]
public List<Supply> Supplies { get; set; } = new();
[Required]
public int ClientId { get; set; }
public static EquipmentReceiving? Create(EquipmentReceivingBindingModel? model)
{
@@ -34,6 +36,7 @@ namespace ComputerShopDatabaseImplement.Models
Status = model.Status,
DateImplement = model.DateImplement,
Id = model.Id,
ClientId = model.ClientId
};
}
@@ -52,6 +55,7 @@ namespace ComputerShopDatabaseImplement.Models
DateImplement = DateImplement,
Id = Id,
Status = Status,
ClientId = ClientId
};
}
}

View File

@@ -24,8 +24,7 @@ namespace ComputerShopDatabaseImplement.Models
public DateTime? DateImplement { get; private set; }
[ForeignKey("OrderId")]
public virtual List<SupplyOrder> Supplies { get; set; } = new();
private Dictionary<int, IOrderModel>? _supplyOrders = null;
public virtual List<SupplyOrder> SupplyOrders { get; set; } = new();
[ForeignKey("OrderId")]
public virtual List<AssemblyOrder> Assemblies { get; set; } = new();
@@ -45,20 +44,6 @@ namespace ComputerShopDatabaseImplement.Models
return _assemblyOrders;
}
}
[NotMapped]
public Dictionary<int, IOrderModel> SupplyOrders
{
get
{
if (_supplyOrders == null)
{
_supplyOrders = Supplies
.ToDictionary(recPC => recPC.SupplyId, recPC =>
(recPC.Order as IOrderModel));
}
return _supplyOrders;
}
}
[Required]
public int ClientId { get; set; }

View File

@@ -24,9 +24,10 @@ namespace ComputerShopDatabaseImplement.Models
public DateTime? DateImplement { get; private set; }
public int OrderId { get; set; }
public int ClientId { get; set; }
public int ReceivingId { get; set; }
public virtual EquipmentReceiving Receiving { get; set; }
public virtual EquipmentReceiving? Receiving { get; set; }
private Dictionary<int, IOrderModel>? _supplyOrders =
null;
@@ -53,6 +54,7 @@ namespace ComputerShopDatabaseImplement.Models
return new Supply
{
Id = model.Id,
ClientId = model.ClientId,
Status = model.Status,
DateCreate = model.DateCreate,
DateImplement = model.DateImplement,
@@ -78,7 +80,8 @@ namespace ComputerShopDatabaseImplement.Models
Status = Status,
DateCreate = DateCreate,
DateImplement = DateImplement,
SupplyOrders = SupplyOrders
SupplyOrders = SupplyOrders,
ClientId = ClientId
};
public void UpdateOrders(ComputerShopDatabase context, SupplyBindingModel model)
{