public void DodajKomentarz(int idPosta, string autor, string tresc, int status) { using (LinqTodbBlogDataContext context = new LinqTodbBlogDataContext()) { Komentarze k = new Komentarze { id_posta = idPosta, autor = autor, tresc = tresc, status = status, data_dodania = DateTime.Now }; context.Komentarzes.InsertOnSubmit(k); context.SubmitChanges(); } }
public bool UsunKomentarz(int id) { using (LinqTodbBlogDataContext context = new LinqTodbBlogDataContext()) { try { Komentarze kom = context.Komentarzes.Single(k => k.id == id); context.Komentarzes.DeleteOnSubmit(kom); context.SubmitChanges(); } catch (InvalidOperationException ex) { return(false); } return(true); } }
private void detach_Komentarzes(Komentarze entity) { this.SendPropertyChanging(); entity.Posty = null; }
partial void DeleteKomentarze(Komentarze instance);
private void attach_Komentarzes(Komentarze entity) { this.SendPropertyChanging(); entity.Posty = this; }
partial void InsertKomentarze(Komentarze instance);
partial void UpdateKomentarze(Komentarze instance);