Putilin P. A. Lab work 2 Hard #11

Closed
Pavel wants to merge 15 commits from Lab2Hard into Lab1Hard
3 changed files with 2 additions and 14 deletions
Showing only changes of commit 85dd33db61 - Show all commits

View File

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

View File

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

View File

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