diff --git a/ComputerStoreDatabaseImplement/Models/PC.cs b/ComputerStoreDatabaseImplement/Models/PC.cs index 704c246..3714977 100644 --- a/ComputerStoreDatabaseImplement/Models/PC.cs +++ b/ComputerStoreDatabaseImplement/Models/PC.cs @@ -93,7 +93,7 @@ namespace ComputerStoreDatabaseImplement.Models context.SaveChanges(); } - foreach(var updateComponent in pcComponents) + foreach(var updateComponent in pcComponents.Where(x => model.PCComponents.ContainsKey(x.ComponentID) && x.RequestID == model.RequestID)) { updateComponent.Count = model.PCComponents[updateComponent.ComponentID].Item2; model.PCComponents.Remove(updateComponent.ComponentID);