Controller.Repositorio.ClienteRepositorio.Alterar C# (CSharp) 메소드

Alterar() 공개 메소드

public Alterar ( Cliente cliente ) : int
cliente Model.Entidades.Cliente
리턴 int
        public int Alterar(Cliente cliente)
        {
            try
            {
                InstanciarClienteBO();
                int retorno = Insucesso;
                if (_clienteBO.VerificarSeJaExisteNaAlteracao(cliente) == NaoExiste)
                {
                    _banco.Entry(cliente).State = EntityState.Modified;
                    retorno = _banco.SaveChanges() == Sucesso ? Sucesso : Sucesso;
                }
                return retorno;

            }
            catch (CustomException erro)
            {
                throw new CustomException(erro.Message);
            }
            catch (Exception erro)
            {
                throw new Exception(erro.Message);
            }
        }