Ejemplo n.º 1
0
 public ActionResult dodajPost(Klasa k)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db_admin.DodajPost(k);
             return RedirectToAction("Index", "Home");
         }
         else
             return View();
     }
     catch
     {
         return RedirectToAction("Error", "Shared");
     }
 }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
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();

                }
        }