コード例 #1
0
ファイル: NewsController.cs プロジェクト: chiennd0705/MyPham
        public JsonResult ReplyComment(long newid, long commentid, int status, string TraLoicontent)
        {
            try
            {
                CommentsNewsBusiness commentbusiness = new CommentsNewsBusiness();
                Common.CommentsNew   comment         = new Common.CommentsNew();
                comment = commentbusiness.GetCommentsByParentID(commentid);
                if (comment == null)
                {
                    Common.CommentsNew comment1 = new Common.CommentsNew();
                    comment1.Content    = TraLoicontent;
                    comment1.CreateDate = DateTime.Now;
                    comment1.NewId      = newid;
                    comment1.ParentId   = commentid;
                    comment1.Status     = 2;
                    comment1.NickName   = SessionUtility.GetSessionName(Session);

                    comment1.Email = "";
                    comment1.Rate  = 5;
                    commentbusiness.AddNew(comment1);
                }
                else
                {
                    comment.Content = TraLoicontent;
                    commentbusiness.Edit(comment);
                }
                return(Json(1, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                // _logger.Debug(ex.Message);
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public JsonResult SubmitFaq(long id, string Name, string Email, string Content)
        {
            bool check = false;

            try
            {
                CommentsNewsBusiness commentbusiness = new CommentsNewsBusiness();
                Common.CommentsNew   comment         = new Common.CommentsNew();
                comment.NewId      = id;
                comment.Content    = Content;
                comment.CreateDate = DateTime.Now;
                comment.Email      = Email;
                comment.Status     = 1;
                comment.NickName   = Name;
                commentbusiness.AddNew(comment);
                check = true;
            }
            catch
            {
                check = false;
            }
            return(Json(new
            {
                data = check,
            }, JsonRequestBehavior.AllowGet));
        }