Штуки

This commit is contained in:
dasha 2023-03-19 12:15:43 +04:00
parent 586c0905ed
commit 50c0cdc17e
3 changed files with 4 additions and 14 deletions

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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();