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 int AddZ_replyComment(Z_replyComment Z_replyComment) { using (AIYunNetContext context = new AIYunNetContext()) { context.Z_replyComment.Add(Z_replyComment); context.SaveChanges(); return(1); } }
/// <summary> /// 删除评论的回复 /// </summary> public int deleteZ_replyComment(int Z_replyCommentid) { using (AIYunNetContext context = new AIYunNetContext()) { Z_replyComment originalZ_replyComment = context.Z_replyComment.Find(Z_replyCommentid); context.Z_replyComment.Remove(originalZ_replyComment); context.SaveChanges(); return(1); } }
/// <summary> /// 获取单个回复 /// </summary> public Z_replyComment GetreplyCommentByGUID(string gid) { Z_replyComment com = new Z_replyComment(); using (AIYunNetContext context = new AIYunNetContext()) { List <Z_replyComment> comlist = context.Z_replyComment.Where(c => c.comment_Guid == gid).ToList(); if (comlist.Count() > 0) { com = comlist[0]; } } return(com); }
/// <summary> /// 修改问题的回复 /// </summary> public int updateZ_replyComment(Z_replyComment Z_replyComment) { using (AIYunNetContext context = new AIYunNetContext()) { Z_replyComment original = context.Z_replyComment.Find(Z_replyComment.id); original.comment_Guid = Z_replyComment.comment_Guid; original.content = Z_replyComment.content; original.from_account = Z_replyComment.from_account; original.from_uname = Z_replyComment.from_uname; original.from_uid_type = Z_replyComment.from_uid_type; original.thum = Z_replyComment.thum; context.SaveChanges(); return(1); } }
public ActionResult AnswerComment(Z_replyComment recom) { int result = 0; if (recom.id == 0) { result = comser.AddZ_replyComment(recom); if (recom.content.Replace(" ", "") != "") { comser.MarkIsAnswer(recom.comment_Guid); } } else { result = comser.updateZ_replyComment(recom); if (recom.content.Replace(" ", "") != "") { comser.MarkIsAnswer(recom.comment_Guid); } } return(Json(new { retCode = result }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 评论回复 /// </summary> public ActionResult _ReComment() { int result = 0; string from_uname = Request["from_uname"]; string from_account = Request["from_account"]; string from_uid_type = Request["from_uid_type"]; string content = Request["content"]; string comment_Guid = Request["comment_Guid"]; string to_account = Request["to_account"]; string to_uid_type = Request["to_uid_type"]; string to_uname = Request["to_uname"]; string thum = "";//获取缩略图 if (!String.IsNullOrEmpty(from_account)) { thum = otherService.getPhotoUrlthum(from_account, from_uid_type); } if (thum == "2") { result = 0; } Z_replyComment model = new Z_replyComment { from_uname = from_uname, from_account = from_account, from_uid_type = from_uid_type, content = content, comment_Guid = comment_Guid, to_account = to_account, to_uid_type = to_uid_type, to_uname = to_uname, thum = thum }; //插入评论回复 result = z_CommentService.AddZ_replyComment(model); return(Json(new { RetCode = result, Z_replyComment = model }, JsonRequestBehavior.AllowGet)); }