Compare commits
No commits in common. "b2185dd836b02b357af34e4adf8f7b4185e3edef" and "edd859332e0a0106789511706ab51950140433be" have entirely different histories.
b2185dd836
...
edd859332e
@ -13,6 +13,7 @@ namespace SushiBarContracts.StoragesContracts
|
||||
ShopViewModel? Insert(ShopBindingModel model);
|
||||
ShopViewModel? Update(ShopBindingModel model);
|
||||
ShopViewModel? Delete(ShopBindingModel model);
|
||||
bool IsEnoughSushi(ISushiModel model, int count);
|
||||
bool SellSushi(ISushiModel model, int count);
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,10 @@ namespace SushiBarDatabaseImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public bool IsEnoughSushi(ISushiModel model, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool SellSushi(ISushiModel model, int count)
|
||||
{
|
||||
using var context = new SushiBarDatabase();
|
||||
|
@ -72,9 +72,16 @@ namespace SushiBarFileImplement.Implements
|
||||
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)
|
||||
{
|
||||
if (source.Shops.Select(x => x.ListSushi.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum() < count)
|
||||
if (!IsEnoughSushi(model, count))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -100,6 +100,11 @@ namespace SushiBarListImplement.Implements
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsEnoughSushi(ISushiModel model, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool SellSushi(ISushiModel model, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
Loading…
Reference in New Issue
Block a user