Методы переделаны в метод
This commit is contained in:
parent
bf9de0295a
commit
c1075ad46a
@ -18,7 +18,6 @@ namespace ShipyardContracts.StoragesContracts
|
||||
ShopViewModel? Insert(ShopBindingModel model);
|
||||
ShopViewModel? Update(ShopBindingModel model);
|
||||
ShopViewModel? Delete(ShopBindingModel model);
|
||||
bool ShipsAreAvailable(IShipModel model, int requiredQuantity);
|
||||
bool SellShips(IShipModel model, int count);
|
||||
}
|
||||
}
|
||||
|
@ -83,14 +83,9 @@ namespace ShipyardFileImplement.Implements
|
||||
source.SaveShops();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
public bool ShipsAreAvailable(IShipModel model, int requiredQuantity)
|
||||
{
|
||||
int availableQuantity = source.Shops.Select(x => x.Ships.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum();
|
||||
return availableQuantity >= requiredQuantity;
|
||||
}
|
||||
public bool SellShips(IShipModel model, int count)
|
||||
{
|
||||
if (!ShipsAreAvailable(model, count))
|
||||
if (source.Shops.Select(x => x.Ships.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum()<count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -110,11 +110,6 @@ namespace ShipyardListImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public bool ShipsAreAvailable(IShipModel model, int requiredQuantity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool SellShips(IShipModel model, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
Loading…
Reference in New Issue
Block a user