예제 #1
0
        public IHttpActionResult LikeComment()
        {
            int CommentID = Convert.ToInt32(requestHelper.GetRequsetForm("CommentID", ""));

            WebApi_BLL.T_Forum_Comment   bll   = new WebApi_BLL.T_Forum_Comment();
            WebApi_Model.T_Forum_Comment model = bll.GetModel(CommentID);
            model.Likes += 1;
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(bll.Update(model)))));
        }
예제 #2
0
        public IHttpActionResult PostComment(dynamic model)
        {
            WebApi_Model.T_Forum_Comment comment = (WebApi_Model.T_Forum_Comment)Newtonsoft.Json.JsonConvert.DeserializeObject(model, typeof(WebApi_Model.T_Forum_Comment));
            WebApi_BLL.T_Forum_Comment   bll     = new WebApi_BLL.T_Forum_Comment();
            WebApi_BLL.T_Forums          tfsbll  = new WebApi_BLL.T_Forums();
            comment.CommentDate = DateTime.Now;
            comment.Status      = 0;
            bll.Add(comment);

            //更新评论数
            WebApi_Model.T_Forums forum = new WebApi_Model.T_Forums();
            forum = tfsbll.GetModel((int)comment.ForumID);
            forum.CommentCount += 1;
            tfsbll.Update(forum);

            #region update giftcount
            DBHelper.GetSingle("update T_Forum_Comment set giftcount = (select giftcount from V_Forum_Gift where ForumID = " + comment.ForumID + " and PostUID = " + comment.UID + ")");
            #endregion

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(comment))));
        }
예제 #3
0
        public IHttpActionResult ViewForum(int ForumID, int UID)
        {
            WebApi_BLL.T_Forums bll = new WebApi_BLL.T_Forums();
            //WebApi_BLL.T_User_BaseInfo tubll = new WebApi_BLL.T_User_BaseInfo();
            WebApi_BLL.T_Forum_Photo   tfpbll = new WebApi_BLL.T_Forum_Photo();
            WebApi_BLL.T_Forum_Comment tfcbll = new WebApi_BLL.T_Forum_Comment();
            WebApi_BLL.T_Forum_Buy     tfbbll = new WebApi_BLL.T_Forum_Buy();
            WebApi_BLL.T_User_BaseInfo tubll  = new WebApi_BLL.T_User_BaseInfo();

            WebApi_Model.T_Forums forumModle = bll.GetModel(ForumID);

            forumModle.UserBaseInfo = tubll.GetModel((int)forumModle.UID);
            //WebApi_Model.T_User_BaseInfo userModel = tubll.GetModel(UID);
            //forumModle.User = userModel;
            forumModle.Views += 1; //查看数+1
            bll.Update(forumModle);
            forumModle.Forum_Photo   = tfpbll.GetModelList("ForumID =" + ForumID);
            forumModle.Forum_Comment = tfcbll.GetModelList("ForumID = " + ForumID);
            forumModle.Forum_Buy     = tfbbll.GetModelList("ForumID=" + ForumID + " and UID = " + UID);

            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(forumModle))));
        }