Ejemplo n.º 1
0
    protected void btnAddPost_Click(object sender, EventArgs e)
    {
        String str;

         str = edited_html.InnerText;
         string mesag = str;

         // we could save database in clean HTML

         //System.Text.StringBuilder sb = new System.Text.StringBuilder(
         //          HttpUtility.HtmlEncode(str));
         //string mesag = "";
         //mesag = sb.ToString();
         //convertHTMLcode conv = new convertHTMLcode();
         //mesag = conv.convertHTMLtext(mesag);

         blogpostsModel.blogdbEntities bl = new blogpostsModel.blogdbEntities();

         if (s == null)
         {

             blogpostsModel.blogpost po = new blogpostsModel.blogpost();
             //po.blogID = 3;
             po.blogMsgText = mesag;
             po.posted = DateTime.Now;
             bl.AddToblogposts(po);
             bl.SaveChanges();

         }
         else
         {
             int requestID2;
             requestID2 = Convert.ToInt16(s);

             blogpostsModel.blogpost ite = bl.blogposts.First(c => c.blogID == requestID2);
             ite.blogMsgText = mesag;
             ite.lastedited = DateTime.Now;
             bl.SaveChanges();

         }

         try
         {
             FormsAuthentication.SignOut();
         }
         catch { }

            Response.Redirect("blog.aspx");
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new blogpost object.
 /// </summary>
 /// <param name="blogID">Initial value of the blogID property.</param>
 public static blogpost Createblogpost(global::System.Int32 blogID)
 {
     blogpost blogpost = new blogpost();
     blogpost.blogID = blogID;
     return blogpost;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the blogposts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToblogposts(blogpost blogpost)
 {
     base.AddObject("blogposts", blogpost);
 }