Exemplo n.º 1
0
        //Create New Reply
        public void NewCommentForPost(CNewReplyCreate replyInfo, int userId)
        {
            tForumReply reply = new tForumReply();

            reply.fPostId        = replyInfo.postId;
            reply.fReplyId       = Guid.NewGuid().ToString();
            reply.fReplyTargetId = replyInfo.targetId;
            reply.fReplySeqNo    = 0;
            reply.fId            = userId;
            reply.fReplyTime     = DateTime.Now;
            reply.fEnableFlag    = true;
            reply.fContent       = replyInfo.content;

            db.tForumReplies.Add(reply);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        //回覆文章 / 回覆回覆
        public ActionResult Reply(CNewReplyCreate replyInfo)
        {
            string status = "";

            //TODO
            //從Session讀取資料
            //判斷是否有登入,如果有登入,取得該會員的fId

            CReply reply = new CReply();

            if (replyInfo.targetType == "POST")
            {
                reply.NewCommentForPost(replyInfo, 5);
            }
            if (replyInfo.targetType == "COMMENT")
            {
                reply.NewCommentForComment(replyInfo, 5);
            }

            return(Content(status));
        }
Exemplo n.º 3
0
        //Create New Reply For Comment
        public void NewCommentForComment(CNewReplyCreate replyInfo, int userId)
        {
            tForumReply targetReply = (from i in db.tForumReplies
                                       where i.fReplyId == replyInfo.targetId && i.fEnableFlag == true
                                       select i).FirstOrDefault();

            if (targetReply != null)
            {
                tForumReply reply = new tForumReply();
                reply.fPostId        = replyInfo.postId;
                reply.fReplyId       = Guid.NewGuid().ToString();
                reply.fReplyTargetId = replyInfo.targetId;
                reply.fReplySeqNo    = targetReply.fReplySeqNo + 1;
                reply.fId            = userId;
                reply.fReplyTime     = DateTime.Now;
                reply.fEnableFlag    = true;
                reply.fContent       = replyInfo.content;

                db.tForumReplies.Add(reply);
                db.SaveChanges();
            }
        }