Esempio n. 1
0
        public ActionResult BaoMing(string userid, string userName, string userphone)
        {
            var user = _articleCommentRepository.GetEntities(m => m.Context.Equals(userphone)).ToList();

            if (user.Count() > 0)
            {
                return(Json(new { date = 0, message = "请勿重复报名!" }));
            }
            else
            {
                var commentmodel = new tblArticleComment
                {
                    FromUser  = userid,
                    ArtId     = 5827,
                    Context   = userphone,
                    CreatTime = DateTime.Now,
                    ParentId  = 0,
                    thumbsup  = 0,
                    ToUser    = userName
                };
                if (_articleCommentRepository.Insert(commentmodel))
                {
                    return(Json(new { date = 1, message = "报名成功" }));
                }
                else
                {
                    return(Json(new { date = 1, message = "报名失败" }));
                }
            }
        }
Esempio n. 2
0
        public ActionResult AddComment(int artId, string text, string touser, string parentId)
        {
            var userID = LoginUserInfo();

            if (string.IsNullOrEmpty(userID))
            {
                return(Json(new { date = 2, message = "请登录" }));
            }
            tblArticleComment model = new tblArticleComment
            {
                ArtId     = artId,
                Context   = text,
                CreatTime = DateTime.Now,
                FromUser  = userID,
                ParentId  = parentId != "" ? int.Parse(parentId) : 0,
                thumbsup  = 0,
                ToUser    = touser
            };

            _articleCommentRepository.Insert(model);
            return(Json(new { date = 1, message = "发送成功" }));
        }