diff --git a/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs index f968fb1..38370ea 100644 --- a/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs +++ b/SushiBar/SushiBarContracts/StoragesContracts/ISushiStorage.cs @@ -13,7 +13,6 @@ namespace SushiBarContracts.StoragesContracts SushiViewModel? Insert(SushiBindingModel model); SushiViewModel? Update(SushiBindingModel model); SushiViewModel? Delete(SushiBindingModel model); - bool HasSushi(ISushiModel model, int needCount); bool SellSushi(ISushiModel model, int count); } } diff --git a/SushiBar/SushiBarFileImplement/Implements/SushiStorage.cs b/SushiBar/SushiBarFileImplement/Implements/SushiStorage.cs index 04399ba..522b360 100644 --- a/SushiBar/SushiBarFileImplement/Implements/SushiStorage.cs +++ b/SushiBar/SushiBarFileImplement/Implements/SushiStorage.cs @@ -72,17 +72,13 @@ namespace SushiBarFileImplement.Implements } return null; } - public bool HasSushi(ISushiModel sushi, int needCount) - { - var temp = source.Shops - .Select(x => x.ListSushi - .FirstOrDefault(x => x.Key == sushi.Id).Value.Item2).Sum(); - return temp >= needCount; - } public bool SellSushi(ISushiModel model, int count) { - if (!HasSushi(model, count)) + var temp = source.Shops + .Select(x => x.ListSushi + .FirstOrDefault(x => x.Key == model.Id).Value.Item2).Sum(); + if (temp < count) { return false; } diff --git a/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs b/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs index a57a5f8..a2bd782 100644 --- a/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs +++ b/SushiBar/SushiBarListImplement/Implements/SushiStorage.cs @@ -100,11 +100,6 @@ namespace SushiBarListImplement.Implements return null; } - public bool HasSushi(ISushiModel model, int needCount) - { - throw new NotImplementedException(); - } - public bool SellSushi(ISushiModel model, int count) { throw new NotImplementedException();