private void button_Click(object sender, RoutedEventArgs e)
        {
            string m = marka.Text;

            var a = from t in db.karticas
                    where t.broj == comboBox1.SelectedItem.ToString()
                    select t;
            var aa = from t2 in db.korisniks
                     where t2.ime == (comboBox.SelectedItem as korisnik).ime
                     select t2;
            telefon tel = new telefon();

            tel.marka       = m;
            tel.idKorisnika = aa.First().id;
            tel.idkartice   = a.FirstOrDefault().id;

            try
            {
                db.telefons.InsertOnSubmit(tel);
                db.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
            w.ucitaj();
            Close();
        }
 private void detach_telefons(telefon entity)
 {
     this.SendPropertyChanging();
     entity.korisnik = null;
 }
 private void attach_telefons(telefon entity)
 {
     this.SendPropertyChanging();
     entity.korisnik = this;
 }
 partial void Deletetelefon(telefon instance);
 partial void Updatetelefon(telefon instance);
 partial void Inserttelefon(telefon instance);