示例#1
0
        public void DodajPost(Klasa new_post)
        {
            using (LinqBlogDataContext dp = new LinqBlogDataContext())
            {
                var p = new post();
                p.tytul        = new_post.tytul;
                p.tresc        = new_post.tresc;
                p.status       = new_post.status;
                p.data_dodania = DateTime.Now;
                dp.posts.InsertOnSubmit(p);
                dp.SubmitChanges();

                var t = new tagi();
                t.id_posta    = p.ID;
                t.keywords    = new_post.keywords;
                t.description = new_post.description;
                dp.tagis.InsertOnSubmit(t);
                dp.SubmitChanges();
            }
        }
示例#2
0
 public void EdytujPost(post new_post)
 {
     using (LinqBlogDataContext dp = new LinqBlogDataContext())
     {
         var e = dp.posts.Single(x => x.ID == new_post.ID);
         e.tytul            = new_post.tytul;
         e.tresc            = new_post.tresc;
         e.status           = new_post.status;
         e.data_modyfikacji = DateTime.Now;
         dp.SubmitChanges();
     }
 }
示例#3
0
 public void DodajKomentarz(int id, Komentarze new_komentarz)
 {
     using (dp)
     {
         var k = new komentarz();
         k.id_posta     = id;
         k.tresc        = new_komentarz.tresc;
         k.autor        = new_komentarz.autor;
         k.data_dodania = DateTime.Now;
         k.status       = 1;
         dp.komentarzs.InsertOnSubmit(k);
         dp.SubmitChanges();
     }
 }