public async Task <bool> CreatePessoa(PessoasDTO DTO) { bool sucess = false; try { var data = DateTime.Now.ToString(); var query = "INSERT INTO contato_cliente (nome, email, funcao_id, telefone, celular, data, USUARIO_id, CLIENTE_id, anotacoes) VALUES ('" + DTO.Nome + "', '" + DTO.Email + "','" + DTO.Funcao_Id + "', '" + DTO.Telefone + "','" + DTO.Telefone + "','" + data + "', '" + Logindto.Id + "', '" + DTO.Cliente_Id + "', '" + DTO.Anotacoes + "')"; bd.Conectar(); await bd.ExecutarComandoSQLAsync(query); } catch (Exception ex) { throw new Exception(ex.Message); } finally { sucess = true; bd.CloseConection(); } if (sucess) { return(true); } else { return(false); } }
public async Task <bool> UpdateClientes(ClientesDTO DTO) { bool isTrue = false; try { var query = "UPDATE cliente SET rsocial='" + DTO.Razao_Social + "', fantasia='" + DTO.Nome_Fantasia + "', categoria_cliente_id='" + DTO.Categoria_Id + "', status_id='" + DTO.Status + "' WHERE id='" + DTO.Id + "'"; bd.Conectar(); await bd.ExecutarComandoSQLAsync(query); } catch (Exception ex) { throw new Exception(ex.Message); } finally { bd.CloseConection(); isTrue = true; } return(isTrue); }