示例#1
0
        /// <summary>
        /// 添加
        /// </summary>
        public int Add(E_Comment model)
        {
            string sql = @"INSERT INTO [comment].[dbo].[dp_comment]([userid],[areaid],[classinfoid],[sex],[ageround],[domain],[job],[contents],[addtime])
                            VALUES(@userid,@areaid,@classinfoid,@sex,@ageround,@domain,@job,@contents,@addtime);SELECT @@IDENTITY;";

            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                return(Convert.ToInt32(conn.ExecuteScalar(sql, model)));
            }
        }
示例#2
0
        public ActionResult CommentContent(E_Comment eComment)
        {
            E_User eUser = HttpContext.Session["user"] as E_User;

            ViewBag.userinfo        = eUser;
            ViewBag.listCommentType = dCommentType.GetListByThemeid(new E_CommentType()
            {
                themeid = eComment.themeid
            });
            ViewBag.listCommentItem = dCommentItem.GetCommentItemByThemeID(eComment.themeid);
            ViewBag.listopinion     = dOpinion.GetList(new E_Opinion()
            {
                themeid = eComment.themeid
            });
            ViewBag.CommentInfo = eComment;
            return(View("~/views/App/CommentContent.cshtml"));
        }
示例#3
0
        public JsonResult SaveCommentContent(E_Comment eComment)
        {
            string msg    = "提交失败!";
            bool   result = false;

            eComment.addtime   = DateTime.Now;
            eComment.commentid = dComment.Add(eComment);
            if (eComment.commentid > 0)
            {
                foreach (var item in eComment.commentcommentitem)
                {
                    item.commentid = eComment.commentid;
                    dCommentCommentItem.Add(item);
                }
                foreach (var item in eComment.commentopinion)
                {
                    item.commentid = eComment.commentid;
                    dCommentOpinion.Add(item);
                }
                msg    = "提交成功!";
                result = true;
            }
            return(Json(new { result = result, msg = msg }, JsonRequestBehavior.AllowGet));
        }