public long Delete(int id)
 {
     try
     {
         _EnderecoBLL = new EnderecoBLL();
         var e = _EnderecoBLL.Get(id);
         return(_EnderecoBLL.Delete(e));
     } catch (Exception ex)
     {
         throw ex;
     }
 }
        public bool Update([FromBody] ImovelViewModel i)
        {
            _imovelBLL = new ImovelBLL();
            var imovelAntigo = _imovelBLL.Get(i.idImovel);

            if (imovelAntigo.idEndereco != i.idEndereco)
            {
                _enderecoBLL = new EnderecoBLL();
                if (_enderecoBLL.Get(i.idEndereco) == null)
                {
                    _enderecoBLL.Insert(i.Endereco);
                }
            }

            return(_imovelBLL.Update(i));
        }
 public Endereco Get(int id)
 {
     _EnderecoBLL = new EnderecoBLL();
     return(_EnderecoBLL.Get(id));
 }