This commit is contained in:
Павел Путилин 2023-04-25 20:45:54 +04:00
parent eadf7da836
commit 85dd33db61
3 changed files with 2 additions and 14 deletions

View File

@ -13,7 +13,6 @@ namespace PrecastConcretePlantContracts.StoragesContract
ShopViewModel? Insert(ShopBindingModel model); ShopViewModel? Insert(ShopBindingModel model);
ShopViewModel? Update(ShopBindingModel model); ShopViewModel? Update(ShopBindingModel model);
ShopViewModel? Delete(ShopBindingModel model); ShopViewModel? Delete(ShopBindingModel model);
bool HasNeedReinforceds(IReinforcedModel reinforced, int needCount);
public bool SellReinforceds(IReinforcedModel reinforced, int needCount); public bool SellReinforceds(IReinforcedModel reinforced, int needCount);
} }
} }

View File

@ -79,18 +79,13 @@ namespace PrecastConcretePlantFileImplement
return shop.GetViewModel; return shop.GetViewModel;
} }
public bool HasNeedReinforceds(IReinforcedModel reinforced, int needCount) public bool SellReinforceds(IReinforcedModel reinforced, int needCount)
{ {
var resultCount = _source.Shops var resultCount = _source.Shops
.Select(shop => shop.Reinforceds .Select(shop => shop.Reinforceds
.FirstOrDefault(x => x.Key == reinforced.Id).Value.Item2) .FirstOrDefault(x => x.Key == reinforced.Id).Value.Item2)
.Sum(); .Sum();
return resultCount >= needCount; if (resultCount >= needCount)
}
public bool SellReinforceds(IReinforcedModel reinforced, int needCount)
{
if (!HasNeedReinforceds(reinforced, needCount))
{ {
return false; return false;
} }
@ -106,7 +101,6 @@ namespace PrecastConcretePlantFileImplement
return true; return true;
} }
} }
return true; return true;
} }
} }

View File

@ -105,11 +105,6 @@ namespace PrecastConcretePlantListImplement
return null; return null;
} }
public bool HasNeedReinforceds(IReinforcedModel reinforced, int needCount)
{
throw new NotImplementedException();
}
public bool SellReinforceds(IReinforcedModel reinforced, int needCount) public bool SellReinforceds(IReinforcedModel reinforced, int needCount)
{ {
throw new NotImplementedException(); throw new NotImplementedException();