public int BuyEquipment(int equipmentId) { int characterCoins = _characterInfo.GetCoins(); int?price = _equipmentAccess.GetEquipmentById(equipmentId).Price; if (price.HasValue) { if (_characterInfo.GetCoins() < _equipmentAccess.GetEquipmentById(equipmentId).Price) { return(price.Value - characterCoins); } else { _inventoryLogic.AddEquipment(equipmentId); _characterManager.RemoveCoins(price.Value); return(0); } } else { return(-1); } }