public ActionResult CreateEssay(Essay model)
        {
            DBHelper tmpDBHelper = new DBHelper();
            var title = model.Title;
            var content = model.Content;
            var userID = Session["UserId"].ToString();

            tmpDBHelper.SqlExcute("insert into Essay(UserId,EssayTitle,EssayContent) values('" + userID + "','" + title + "','" + content + "')");
            return Redirect("ListEssay");
        }
        public ActionResult UpdateEssay(Essay model)
        {
            DBHelper tmpDBHelper = new DBHelper();
            var uid = Session["UserId"].ToString();
            var new_title = model.Title;
            var new_content = model.Content;
            string old_title = (string)Session["CurrentTitle"];
            string old_content = (string)Session["CurrentContent"];

            tmpDBHelper.UpdateEssay(uid, old_title, old_content, new_title, new_content);

            return Redirect("ManageEssay");
        }
 //返回文章列表
 public List<Essay> GetEssayList()
 {
     List<Essay> EssayList = new List<Essay>();
     con.Open();
     SqlCommand cmd = new SqlCommand("select * from Essay", con);
     SqlDataReader reader = cmd.ExecuteReader();
     while (reader.Read())
     {
         Essay essay = new Essay();
         essay.UserID = reader["UserId"].ToString();
         essay.Title = reader["EssayTitle"].ToString();
         essay.Content = reader["EssayContent"].ToString();
         EssayList.Add(essay);
     }
     con.Close();
     return EssayList;
 }
        //根据用户名和标题获取日志
        public Essay GetEssyByUid_Title(string uid, string title)
        {
            con.Open();
            Essay essay = new Essay();
            string cmdText = "select * from Essay where UserId = '" + uid + "'and EssayTitle = '" + title + "'";
            SqlCommand cmd = new SqlCommand(cmdText, con);
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {

                essay.UserID = uid;
                essay.Title = title;
                essay.Content = reader["EssayContent"].ToString();
            }
            con.Close();
            return essay;
        }