Example #1
0
    static public void updatelikeviews(string str, string count)
    {
        if (user_id == null)
        {
            System.Web.HttpContext.Current.Response.Write("<script>alert('你还没有登录!先去登录吧');location.href='/Views/Index/Index.aspx'</script>");
        }
        Like like_two = new Like();

        like_two.articleId = article.articleId;
        like_two.accountId = user_id;
        article.likes      = Int32.Parse(count);
        articleDao.Update(article);
        List <Like> likes = likeDao.GetListByAccount(user_id);

        foreach (Like like in likes)
        {
            if (like.articleId == id)
            {
                likeDao.Delete(like);
                return;
            }
        }
        if (str == "已赞")
        {
            likeDao.Delete(like_two);
        }
        if (str == "赞")
        {
            likeDao.Insert(like_two);
        }
    }
Example #2
0
        public void setDisLike(long senMeanId)
        {
            LikeDao lkDao    = new LikeDao();
            A_Like  sTblLike = lkDao.getLstLike(senMeanId);

            if (sTblLike == null)
            {
                lkDao.Insert(new A_Like()
                {
                    SenMeanId = senMeanId, LikeFlag = 0
                });
            }
            else
            {
                lkDao.UpdateDisLike(sTblLike);
            }
        }
Example #3
0
 public bool Save(Like like)
 {
     return(dao.Insert(like));
 }