internal void AddComment(string comment) { Comment c = new Comment(); c.Body = comment; c.CommentByAccountID = _webContext.CurrentUser.AccountID; c.CommentByUsername = _webContext.CurrentUser.Username; c.CreateDate = DateTime.Now; c.SystemObjectID = _view.SystemObjectID; c.SystemObjectRecordID = _view.SystemObjectRecordID; Comment.SaveComment(c); // _view.ClearComments(); // LoadComments(); }
public List<Comment> AddComment(Comment data) { if (IsValid()) { IUserSession userSession = ObjectFactory.GetInstance<IUserSession>(); data.CommentByAccountID = userSession.CurrentUser.AccountID; data.CommentByUsername = userSession.CurrentUser.Username; data.CreateDate = DateTime.Now; long commentID = Comment.SaveComment(data); List<Comment> list = Comment.Find(x => x.CommentID == commentID); list.ForEach(x => x.AuthorCanDelete = true); return list; } return new List<Comment>(); }
public static long SaveComment(Comment comment) { if (comment.CommentID > 0) { Update(comment); } else { Add(comment); } return comment.CommentID; }
public static void DeleteComment(Comment comment) { Delete(comment.CommentID); }