Исправление ошибок прошлого

This commit is contained in:
dasha 2023-03-09 13:13:48 +04:00
parent 1db299c9b1
commit 75e4c71d5d
3 changed files with 1 additions and 14 deletions

View File

@ -13,7 +13,6 @@ namespace SushiBarContracts.StoragesContracts
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 IsEnoughSushi(ISushiModel model, int count);
bool SellSushi(ISushiModel model, int count); bool SellSushi(ISushiModel model, int count);
} }
} }

View File

@ -72,16 +72,9 @@ namespace SushiBarFileImplement.Implements
return null; return null;
} }
public bool IsEnoughSushi(ISushiModel model, int count)
{
int temp = source.Shops
.Select(x => x.ListSushi.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum();
return temp >= count;
}
public bool SellSushi(ISushiModel model, int count) public bool SellSushi(ISushiModel model, int count)
{ {
if (!IsEnoughSushi(model, count)) if (source.Shops.Select(x => x.ListSushi.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum() < count)
{ {
return false; return false;
} }

View File

@ -100,11 +100,6 @@ namespace SushiBarListImplement.Implements
return null; return null;
} }
public bool IsEnoughSushi(ISushiModel model, int count)
{
throw new NotImplementedException();
}
public bool SellSushi(ISushiModel model, int count) public bool SellSushi(ISushiModel model, int count)
{ {
throw new NotImplementedException(); throw new NotImplementedException();