Skip to content

Instantly share code, notes, and snippets.

@angelobelchior
Created April 7, 2015 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelobelchior/59026c02bb530f2b162d to your computer and use it in GitHub Desktop.
Save angelobelchior/59026c02bb530f2b162d to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace MeuDB
{
public partial class MyPage : ContentPage
{
public MyPage ()
{
InitializeComponent ();
using(var dados = new AcessoDados())
{
this.Lista.ItemsSource = dados.Listar ();
}
}
protected void SalvarClicked(object sender, EventArgs e)
{
var contato = new Contato {
Nome = this.Nome.Text,
Email = this.Email.Text,
Telefone = this.Telefone.Text
};
using(var dados = new AcessoDados())
{
dados.Insert (contato);
this.Lista.ItemsSource = dados.Listar ();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment