Beispiel #1
0
        public async Task <BancoResponse> UpdateAsync(int bancoId, Banco banco)
        {
            if (banco == null)
            {
                return(new BancoResponse(_localizer["BancoEsNulo"]));
            }

            var existingBanco = await _bancoRepository.FindByIdAsync(bancoId);

            if (existingBanco == null)
            {
                return(new BancoResponse(_localizer["BancoNotFound"]));
            }

            existingBanco.Nombre = banco.Nombre;
            existingBanco.Código = banco.Código;

            try
            {
                _bancoRepository.Update(existingBanco);
                await _unitOfWork.CompleteAsync();

                return(new BancoResponse(existingBanco));
            }
            catch (Exception ex)
            {
                // Do some logging stuff
//				return new BancoResponse($"An error occurred when updating the banco: {ex.Message}");
                return(new BancoResponse(_localizer["BancoErrorActualizando"] + ex.Message));
            }
        }
Beispiel #2
0
 public Int32 Edit(BANCO item, LOG log)
 {
     using (DbContextTransaction transaction = Db.Database.BeginTransaction(IsolationLevel.ReadCommitted))
     {
         try
         {
             BANCO obj = _baseRepository.GetById(item.BANC_CD_ID);
             _baseRepository.Detach(obj);
             _logRepository.Add(log);
             _baseRepository.Update(item);
             transaction.Commit();
             return(0);
         }
         catch (Exception ex)
         {
             transaction.Rollback();
             throw ex;
         }
     }
 }
        public BaseRetornoDTO <bool> Update(BancoViewModel t)
        {
            BaseRetornoDTO <bool> retornoDTO = new BaseRetornoDTO <bool>();

            BaseExceptionSystem <bool> .BaseHandleExcetion(() =>
            {
                var banco = Mapper.Map <BancoViewModel, BancoEntity>(t);
                _bancoRepository.Update(banco);
                retornoDTO.Value = true;
            }, MensagemSistema.FormataMensagem(MensagemSistema.Alterar, MensagemSistema.Banco), ref retornoDTO);

            return(retornoDTO);
        }
Beispiel #4
0
        public Task <CommandResult> Handle(UpdateBancoCommand command, CancellationToken cancellationToken)
        {
            if (!command.IsValid())
            {
                NotifyCommandErrors(command);
                return(Response());
            }

            Banco banco = new Banco(command.Id, command.Nome, command.CodigoCompensacao);

            _bancoRepository.Update(banco);

            if (Commit())
            {
                _mediator.Publish(new UpdatedBancoEvent());
            }

            return(Response());
        }
 public void Atualizar(Banco banco)
 {
     _bancoRepository.Update(banco);
 }
Beispiel #6
0
 public bool Update(Banco entity)
 {
     return(bancoRepository.Update(entity));
 }
Beispiel #7
0
        public Banco UpdateBanco(Banco Banco)
        {
            var ResultadoEntity = _bancoRepository.Update(BancoMapper.Map(Banco));

            return(BancoMapper.Map(ResultadoEntity));
        }