public static void delete(Noticias pNoticia) { DataBase db = GetDataBase(); var query = from t in db.Noticia where t.Id == pNoticia.Id select t; db.Noticia.DeleteOnSubmit(query.ToList()[0]); db.SubmitChanges(); }
private void appBarSave_Click(object sender, EventArgs e) { Noticias noticias = new Noticias { News = feedListBox.SelectedItem as Object }; NoticiasRepositorio.create(noticias); MessageBox.Show("Noticia Salva!"); }
public static void create(Noticias pNoticia) { DataBase db = GetDataBase(); db.Noticia.InsertOnSubmit(pNoticia); db.SubmitChanges(); }
private void appBarSave_Click(object sender, EventArgs e) { try { Noticias noticias = new Noticias { title = salva.title, description = salva.description, link = salva.link }; NoticiasRepositorio.create(noticias); MessageBox.Show("Noticia Salva!"); } catch (Exception) { MessageBox.Show("Selecione uma Noticia para Salva-la!"); } }
private void lstSalvasOnSelectionChange(object sender, SelectionChangedEventArgs e) { salva = (sender as ListBox).SelectedItem as Noticias; }