public ActionResult CommentAnswer(int id) { Z_Comment com = comser.GetCommentByID(id); ViewBag.com = com; Z_replyComment recom = comser.GetreplyCommentByGUID(com.comment_guid); return(View(recom)); }
/// <summary> /// 获取单个问题 /// </summary> public Z_Comment GetCommentByID(int id) { Z_Comment com = new Z_Comment(); using (AIYunNetContext context = new AIYunNetContext()) { com = context.Z_Comment.Find(id); } return(com); }
/// <summary> /// 标记是否回答 /// </summary> public int MarkIsAnswer(string gid) { Z_Comment com = new Z_Comment(); using (AIYunNetContext context = new AIYunNetContext()) { com = context.Z_Comment.Where(c => c.comment_guid == gid).ToList()[0]; com.IsAnswer = 1; context.SaveChanges(); } return(1); }
public int addz_comment(Z_Comment z_comment) { string sql = "insert into Z_Comment values(@Z_Id,@Z_C_Content,@Z_C_time,@UserId)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@Z_Id", z_comment.Z_Id), new SqlParameter("@Z_C_Content", z_comment.Z_C_Content), new SqlParameter("@Z_C_Time", z_comment.Z_C_Time), new SqlParameter("@UserId", z_comment.UserId) }; return(DBHelper.GetExcuteNonQuery(sql, sp)); }
public ActionResult _CommentCase() { string from_uname = Request["from_uname"]; string from_account = Request["from_account"]; string from_uid_type = Request["from_uid_type"]; string topic_id = Request["topic_id"]; string topic_type = Request["topic_type"]; string commentcontent = Request["commentcontent"]; int result = 0; MsSqlDataSource mysqlD = new MsSqlDataSource(); string thum = "";//获取缩略图 if (!String.IsNullOrEmpty(from_account)) { thum = otherService.getPhotoUrlthum(from_account, from_uid_type); } if (thum == "2") { return(Json(new { RetCode = result }, JsonRequestBehavior.AllowGet)); } //插入评论 string comment_guid = Guid.NewGuid().ToString(); string insertStr = string.Format("insert into Z_Comment(topic_id,topic_type,content,from_uname,from_account,from_uid_type,addtime,comment_guid,thum) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", topic_id, topic_type, commentcontent, from_uname, from_account, from_uid_type, DateTime.Now.ToString("yyyy-MM-dd"), comment_guid, thum); result = mysqlD.ExecuteNonQuery(insertStr); Z_Comment comment = new Z_Comment(); if (result > 0) { comment = new Z_Comment { from_uname = from_uname, from_account = from_account, from_uid_type = from_uid_type, content = commentcontent, addtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), thum = thum, comment_guid = comment_guid }; } return(PartialView(comment)); }
public static int addz_comment(Z_Comment z_comment) { return(iz_comment.addz_comment(z_comment)); }