コード例 #1
0
 private void BiuroAdd_Click(object sender, RoutedEventArgs e)
 {
     using (var ctx = new BazyDanychContext())
     {
         Biuro tmp = new Biuro {
             Adres = BiuroAdres.Text, Powierzchnia = float.Parse(BiuroPowierzchnia.Text), Typ = "Biuro", PracownikID = Int32.Parse(BiuroPracownik.Text), TypBiura = BiuroTyp.Text, Stanowiska = Int32.Parse(BiuroStanowiska.Text), Parking = BiuroParking.Text
         };
         ctx.Nieruchomosc.Add(tmp);
         ctx.SaveChanges();
     }
     InitTabs();
 }
コード例 #2
0
 private void BiuroRemove_Click(object sender, RoutedEventArgs e)
 {
     using (var ctx = new BazyDanychContext())
     {
         Biuro tmp = new Biuro {
             ID = BiuroL.ElementAt <Biuro>(BiuroList.SelectedIndex).ID
         };
         ctx.Nieruchomosc.Attach(tmp);
         ctx.Nieruchomosc.Remove(tmp);
         ctx.SaveChanges();
     }
     InitTabs();
 }