Пример #1
0
        public void TestarInsertEndereco()
        {
            Endereco test = new Endereco(1, logradouro, 123, "123");

            str = bll.Insert(test);

            Assert.AreEqual(str, "Endereço cadastrado com sucesso");
        }
 public long Insert(ImovelViewModel i)
 {
     _imovelBLL   = new ImovelBLL();
     _enderecoBLL = new EnderecoBLL();
     if (i.idEndereco == 0)
     {
         long e = _enderecoBLL.Insert(RetornarEndereco(i.Endereco));
         i.idEndereco = (int)e;
     }
     return(_imovelBLL.Insert(i));
 }
        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 long Post([FromBody] Endereco i)
 {
     _EnderecoBLL = new EnderecoBLL();
     return(_EnderecoBLL.Insert(i));
 }