Esempio n. 1
0
        //funkcja dodawania posta
        public bool DodajPosta(PostNew new_post)
        {
            try
            {
                Post post = new Post();
                post.data_dodania     = new_post.data_dodania;
                post.data_modyfikacji = new_post.data_modyfikacji;
                post.status           = 0;
                post.tresc            = new_post.tresc;
                post.tytul            = new_post.tytul;

                db.Posts.InsertOnSubmit(post);
                db.SubmitChanges();


                Tagi tag = new Tagi();
                tag.id_post     = post.id;
                tag.description = new_post.description;
                tag.keywords    = new_post.keywords;

                db.Tagis.InsertOnSubmit(tag);
                db.SubmitChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 2
0
        //funkcja dodawania posta
        public bool DodajPosta(PostNew new_post)
        {
            try
            {
                Post post = new Post();
                post.data_dodania = new_post.data_dodania;
                post.data_modyfikacji = new_post.data_modyfikacji;
                post.status = 0;
                post.tresc = new_post.tresc;
                post.tytul = new_post.tytul;

                db.Posts.InsertOnSubmit(post);
                db.SubmitChanges();

                Tagi tag = new Tagi();
                tag.id_post = post.id;
                tag.description = new_post.description;
                tag.keywords = new_post.keywords;

                db.Tagis.InsertOnSubmit(tag);
                db.SubmitChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }
Esempio n. 3
0
 public ActionResult DodajPost(PostNew obiekt)
 {
     if (db_admin.DodajPosta(obiekt))
     {
         ViewData["action"] = "Post zostal dodany ;)";
     }
     else
     {
         ViewData["action"] = "Post nie zostal dodany ;(";
     }
     return View(obiekt);
 }