コード例 #1
0
ファイル: Program.cs プロジェクト: glaucia86/Aula_04
        static void Main(string[] args)
        {
            try
            {
                Leitura l = new Leitura();
                Pessoa  p = new Pessoa();

                p.Nome  = l.ObterNome();
                p.Email = l.ObterEmail();

                PessoaDAL d = new PessoaDAL();

                d.Gravar(p);
                Console.WriteLine("Dados Gravados com Sucesso!!!!");

                //Listando todos os dados da tabela:
                foreach (Pessoa pes in d.ListarTodos())
                {
                    Console.WriteLine("\n");
                    Console.Write("\nCódigo............: " + pes.IdPessoa);
                    Console.Write("\nNome..............: " + pes.Nome);
                    Console.Write("\nEmail.............: " + pes.Email);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Erro....: " + e.Message);
            }

            Console.ReadKey();
        }
コード例 #2
0
        public List <Pessoa> ListarTodos()
        {
            try
            {
                List <Pessoa> lista = pessoaDAL.ListarTodos();

                return(lista);
            }catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        public List <Pessoa> ListarTodos()
        {
            var lista = _dal.ListarTodos();

            return(lista);
        }