示例#1
0
        public FormaPagamento AtualizarFormaPagamento(FormaPagamento formaPagamento)
        {
            formaPagamento.Validar();
            AssertionConcern.AssertArgumentNotEquals(0, formaPagamento.FormaPagamentoCodigo,
                                                     string.Format(Erros.NotZeroParameter, "FormaPagamentoCodigo"));
            var formaPagamentoAtual =
                _formaPagamentoRepository.ObterPorCodigo(formaPagamento.FormaPagamentoCodigo);

            formaPagamentoAtual.Ativo     = formaPagamento.Ativo;
            formaPagamentoAtual.Descricao = formaPagamento.Descricao;
            return(_formaPagamentoRepository.Atualizar(formaPagamentoAtual));
        }
        public async Task <bool> Atualizar(FormaPagamento formaPagamento)
        {
            if (!ExecutarValidacao(new FormaPagamentoValidation(), formaPagamento))
            {
                return(false);
            }

            if (_formaPagamentoRepository.JaExiste(formaPagamento.Id, formaPagamento.Nome))
            {
                Notificar("Já existe uma forma de pagamento com este nome informado.");
                return(false);
            }

            await _formaPagamentoRepository.Atualizar(formaPagamento);

            return(true);
        }