Ejemplo n.º 1
0
 private void btnCari_Click(object sender, EventArgs e)
 {
     lblNama1.Text = "-";
     lblUsia1.Text = "-";
     tbHasil.Text  = "-";
     using (var db = new RiwayatModel())
     {
         var query = from table in db.Tables where table.Nama == tbCari.Text select table;
         foreach (var item in query)
         {
             lblNama1.Text = item.Nama;
             lblUsia1.Text = item.Usia;
             tbHasil.Text  = item.Analisis;
         }
     }
 }
Ejemplo n.º 2
0
 private void TambahDataRiwayat()
 {
     if (tbNama.Text != "" && tbUsia.Text != "" && tbHasil.Text != "")
     {
         using (var db = new RiwayatModel())
         {
             table = new Table
             {
                 Nama     = tbNama.Text,
                 Usia     = tbUsia.Text,
                 Analisis = tbHasil.Text,
             };
             db.Tables.Add(table);
             db.SaveChanges();
             MessageBox.Show("Riwayat Ditambahkan");
         }
     }
 }