Пример #1
0
        public void hacerDeposito(decimal cantidad, DateTime fecha, string nota)
        {
            if (cantidad <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(cantidad), "La cantidad del deposito debe ser positiva");
            }
            var deposito = new Transacciones(cantidad, fecha, nota);

            todasTransacciones.Add(deposito);
        }
Пример #2
0
        public void hacerRetiro(decimal cantidad, DateTime fecha, string nota)
        {
            if (cantidad <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(cantidad), "La cantidad del retiro debe ser positiva");
            }
            if (Balance - cantidad < 0)
            {
                throw new InvalidOperationException("Fondos insuficientes para retirar");
            }
            var retiro = new Transacciones(-cantidad, fecha, nota);

            todasTransacciones.Add(retiro);
        }