コード例 #1
0
        //funkcja dodawania komentarza
        public bool DodajKomentarz(int id_post, Komentarze new_komentarz)
        {
            try
            {
                Komentarze komentarz = KomentarzDoPost(id_post);
                komentarz.id_komentarza = new_komentarz.id_komentarza;

                //komentarz.id_posta = new_komentarz.id_posta;
                komentarz.id_posta = id_post;

                komentarz.tresc_komentarza        = new_komentarz.tresc_komentarza;
                komentarz.autor_komentarza        = new_komentarz.autor_komentarza;
                komentarz.data_dodania_komentarza = DateTime.Now;// new_komentarz.data_dodania_komentarza;
                komentarz.status = new_komentarz.status;

                db.Komentarzes.InsertOnSubmit(komentarz);
                db.SubmitChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #2
0
        //funkcja dodawania komentarza
        public bool DodajKomentarz(int id_post, Komentarze new_komentarz)
        {
            try
            {

                Komentarze komentarz = KomentarzDoPost(id_post);
                komentarz.id_komentarza = new_komentarz.id_komentarza;

                //komentarz.id_posta = new_komentarz.id_posta;
                komentarz.id_posta = id_post;

                komentarz.tresc_komentarza = new_komentarz.tresc_komentarza;
                komentarz.autor_komentarza = new_komentarz.autor_komentarza;
                komentarz.data_dodania_komentarza = DateTime.Now;// new_komentarz.data_dodania_komentarza;
                komentarz.status = new_komentarz.status;

                db.Komentarzes.InsertOnSubmit(komentarz);
                db.SubmitChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #3
0
        public Komentarze KomentarzDoPost(int id_post)
        {
            Komentarze komentarz = new Komentarze();

            komentarz.id_posta = id_post;
            komentarz.data_dodania_komentarza = DateTime.Now;
            return(komentarz);
        }
コード例 #4
0
        public ActionResult DodajKom()
        {
            Komentarze kom = new Komentarze();

            ViewData["list"] = lista();

            return PartialView(kom);
        }
コード例 #5
0
 public ActionResult DodajKomentarz(int id, Komentarze new_komentarz)
 {
     if (db_admin.DodajKomentarz(id, new_komentarz))
     {
         ViewData["action"] = "Komentarz zostal dodany ;)";
     }
     else
     {
         ViewData["action"] = "Komentarz nie zostal dodany ;(";
     }
     return View(new_komentarz);
 }
コード例 #6
0
ファイル: BlogDB.Designer.cs プロジェクト: artd016/Blog
        /// <summary>
        /// Create a new Komentarze object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="id_posta">Initial value of the id_posta property.</param>
        /// <param name="tresc">Initial value of the tresc property.</param>
        /// <param name="autor">Initial value of the autor property.</param>
        /// <param name="data_dodania">Initial value of the data_dodania property.</param>
        /// <param name="status">Initial value of the status property.</param>
        public static Komentarze CreateKomentarze(global::System.Int32 id, global::System.Int32 id_posta, global::System.String tresc, global::System.String autor, global::System.DateTime data_dodania, global::System.Int32 status)
        {
            Komentarze komentarze = new Komentarze();

            komentarze.id           = id;
            komentarze.id_posta     = id_posta;
            komentarze.tresc        = tresc;
            komentarze.autor        = autor;
            komentarze.data_dodania = data_dodania;
            komentarze.status       = status;
            return(komentarze);
        }
コード例 #7
0
        public bool UsunPosta(int id)
        {
            try
            {
                Tagi deleteTag = null;
                do
                {
                    try
                    {
                        deleteTag = UsunDoTagi(id);

                        db.Tagis.DeleteOnSubmit(deleteTag);
                        db.SubmitChanges();
                    }
                    catch
                    {
                        deleteTag = null;
                    }
                } while (deleteTag != null);



                Komentarze deleteKomentarz = null;
                do
                {
                    try
                    {
                        deleteKomentarz = UsunDoKomentarze(id);
                        db.Komentarzes.DeleteOnSubmit(deleteKomentarz);
                        db.SubmitChanges();
                    }
                    catch
                    {
                        deleteKomentarz = null;
                    }
                } while (deleteKomentarz != null);

                Post deletePost = UsunDoPost(id);

                db.Posts.DeleteOnSubmit(deletePost);
                db.SubmitChanges();



                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #8
0
        public bool UsunKomentarz(int id)
        {
            Komentarze deleteKomentarz = UsunDoKomentarzaIdKomentarz(id);

            try
            {
                db.Komentarzes.DeleteOnSubmit(deleteKomentarz);
                db.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #9
0
ファイル: HomeController.cs プロジェクト: artd016/Blog
        public ActionResult DodajKom(Komentarze nkom)
        {
            if (ModelState.IsValid)
            {
                nkom.id_posta = nkom.id;//??
                nkom.id = 0;
                nkom.data_dodania = DateTime.Now;

                blogDB.AddToKomentarze(nkom);
                blogDB.SaveChanges();

                return View();
            }
            else
            {
                return View(nkom);
            }
        }
コード例 #10
0
ファイル: BlogEnt.Designer.cs プロジェクト: artd016/Blog
 /// <summary>
 /// Create a new Komentarze object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="id_posta">Initial value of the id_posta property.</param>
 /// <param name="tresc">Initial value of the tresc property.</param>
 /// <param name="autor">Initial value of the autor property.</param>
 /// <param name="data_dodania">Initial value of the data_dodania property.</param>
 /// <param name="status">Initial value of the status property.</param>
 public static Komentarze CreateKomentarze(global::System.Int32 id, global::System.Int32 id_posta, global::System.String tresc, global::System.String autor, global::System.DateTime data_dodania, global::System.Int32 status)
 {
     Komentarze komentarze = new Komentarze();
     komentarze.id = id;
     komentarze.id_posta = id_posta;
     komentarze.tresc = tresc;
     komentarze.autor = autor;
     komentarze.data_dodania = data_dodania;
     komentarze.status = status;
     return komentarze;
 }
コード例 #11
0
ファイル: HomeController.cs プロジェクト: artd016/Blog
        public ActionResult DodajKom()
        {
            Komentarze kom = new Komentarze();

            return PartialView(kom);
        }
コード例 #12
0
 private void detach_Komentarzes(Komentarze entity)
 {
     this.SendPropertyChanging();
     entity.Post = null;
 }
コード例 #13
0
ファイル: BlogEnt.Designer.cs プロジェクト: artd016/Blog
 /// <summary>
 /// Deprecated Method for adding a new object to the Komentarze EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToKomentarze(Komentarze komentarze)
 {
     base.AddObject("Komentarze", komentarze);
 }
コード例 #14
0
 public Komentarze KomentarzDoPost(int id_post)
 {
     Komentarze komentarz = new Komentarze();
     komentarz.id_posta = id_post;
     komentarz.data_dodania_komentarza = DateTime.Now;
     return komentarz;
 }
コード例 #15
0
 private void attach_Komentarzes(Komentarze entity)
 {
     this.SendPropertyChanging();
     entity.Post = this;
 }
コード例 #16
0
 partial void InsertKomentarze(Komentarze instance);
コード例 #17
0
 partial void UpdateKomentarze(Komentarze instance);
コード例 #18
0
 partial void UpdateKomentarze(Komentarze instance);
コード例 #19
0
 partial void DeleteKomentarze(Komentarze instance);
コード例 #20
0
        public Komentarze UsunDoKomentarzaIdKomentarz(int id)
        {
            Komentarze deleteKomentarz = (from m in db.Komentarzes where m.id_komentarza == id select m).First();

            return(deleteKomentarz);
        }
コード例 #21
0
		private void attach_Komentarzes(Komentarze entity)
		{
			this.SendPropertyChanging();
			entity.Post = this;
		}
コード例 #22
0
		private void detach_Komentarzes(Komentarze entity)
		{
			this.SendPropertyChanging();
			entity.Post = null;
		}
コード例 #23
0
ファイル: BlogDB.Designer.cs プロジェクト: artd016/Blog
 /// <summary>
 /// Deprecated Method for adding a new object to the Komentarze EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToKomentarze(Komentarze komentarze)
 {
     base.AddObject("Komentarze", komentarze);
 }
コード例 #24
0
 partial void DeleteKomentarze(Komentarze instance);
コード例 #25
0
 partial void InsertKomentarze(Komentarze instance);
コード例 #26
0
 public ActionResult UsunKomentarz(int id, Komentarze komentarz)
 {
     //<input type="text" value="<%=Model.id.ToString() %>" readonly = "readonly" />
     if (db_admin.UsunKomentarz(id))
     {
         ViewData["action"] = "Komentarz zostal usuniety ;)";
     }
     else
     {
         ViewData["action"] = "Komentarz nie zostal usuniety ;(";
     }
     return View(komentarz);
 }