/// <summary> /// 保存评论信息 /// </summary> /// <param name="CommentModel"></param> /// <returns></returns> public JsonResult SaveComment(tb_comment CommentModel) { ResultModel result = new ResultModel(); try { if (String.IsNullOrEmpty(CommentModel.Id)) { CommentModel.Id = GetNewGuid(); CommentModel.InsertTime = DateTime.Now; CommentModel.Account = loginUser.Id; ef.tb_comment.Add(CommentModel); } else { var commentData = _CommentBusiness.GetCommentInfoByComId(CommentModel.Id).FirstOrDefault(); commentData.Subject = CommentModel.Subject; commentData.Content = CommentModel.Content; } ef.SaveChanges(); result.ResultCode = 1; } catch (Exception ex) { } return(Json(result)); }
public bool DelComment(string comId) { bool result = false; try { tb_comment data = ef.tb_comment.Where(c => c.Id == comId).FirstOrDefault(); if (data != null) { ef.tb_comment.Remove(data); result = true; } } catch (Exception ex) { result = false; } return(result); }