private void Button_Click(object sender, RoutedEventArgs e) { DBObjekat objekatBaza = new DBObjekat(); objekatBaza.ucitajObjekte(); foreach (Objekat k in objekatBaza.Objekti) { if (ime.Text == k.ime + " " + k.prezime) { objekatBaza.brisiObjekat(k); } } }
public void ObrisiObjekat(String username) { DBObjekat DB = new DBObjekat(); VMObjekat v; v = new VMObjekat(); List <Objekat> temp = v.UčitavanjeObjekata(); Objekat k = temp.FirstOrDefault(x => x.username == username); if (k != null) { DB.brisiObjekat(k); } }