public ActionResult AddComment(string body,long belongId,long userId,string type) { Uto_Comment comment = new Uto_Comment(); comment.Body = body; comment.UserId = userId; comment.SendUserId = UserContext.CurrentUser.UserId; comment.DateCreated = DateTime.Now; comment.Type = type; comment.BelongId = belongId; utopiaService.AddComment(comment); //更新被评论数 UpdateCommentCount(belongId, type,true); //发出评论通知 Message message = Message.New(); message.IsIgnore = false; message.UserId = userId; message.BelongId = belongId; message.ChildrenBelongId = comment.CommentId; message.DateCreated = DateTime.Now; message.Type = type; Uto_Message dbMessage = message.AsDbMessage(); utopiaService.SendMessage(dbMessage); return Json(1); }
/// <summary> /// 创建新的 Uto_Comment 对象。 /// </summary> /// <param name="commentId">CommentId 属性的初始值。</param> /// <param name="body">Body 属性的初始值。</param> /// <param name="userId">UserId 属性的初始值。</param> /// <param name="sendUserId">SendUserId 属性的初始值。</param> /// <param name="type">Type 属性的初始值。</param> /// <param name="dateCreated">DateCreated 属性的初始值。</param> /// <param name="belongId">BelongId 属性的初始值。</param> public static Uto_Comment CreateUto_Comment(global::System.Int64 commentId, global::System.String body, global::System.Int64 userId, global::System.Int64 sendUserId, global::System.String type, global::System.DateTime dateCreated, global::System.Int64 belongId) { Uto_Comment uto_Comment = new Uto_Comment(); uto_Comment.CommentId = commentId; uto_Comment.Body = body; uto_Comment.UserId = userId; uto_Comment.SendUserId = sendUserId; uto_Comment.Type = type; uto_Comment.DateCreated = dateCreated; uto_Comment.BelongId = belongId; return uto_Comment; }
/// <summary> /// 用于向 Uto_Comment EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToUto_Comment(Uto_Comment uto_Comment) { base.AddObject("Uto_Comment", uto_Comment); }