PIbd-22 Kaznacheeva E.K. LabWork_2_hard #12

Closed
kaznacheeva wants to merge 11 commits from LabWork_2_hard into LabWork_2
Showing only changes of commit 14adec6f17 - Show all commits

View File

@ -112,9 +112,9 @@ namespace SoftwareInstallationFileImplement
public bool CheckCount(IPackageModel model, int quantity)
{
int store = source.Shops
.Select(x => x.ShopPackages
.Select(y => (y.Value.Item1.Id == model.Id ? y.Value.Item2 : 0))
.Sum()).Sum();
.SelectMany(x => x.ShopPackages)
.Where(y => y.Value.Item1.Id == model.Id && y.Value.Item2 > 0)
.Sum(y => y.Value.Item2);
return store >= quantity;
}