示例#1
0
        public static long CreateComment(PostComment comment)
        {
            using (var context = new BackofficeUnitOfWork())
            {
                comment.Active = true;
                comment.Date   = DateTime.Now;

                context.PostComment.Create(comment);
                context.Save();

                return(comment.ID);
            }
        }
示例#2
0
        public static bool DeleteCommentAsAdmin(long commentId)
        {
            using (var context = new BackofficeUnitOfWork())
            {
                PostComment comment = context.PostComment
                                      .Fetch()
                                      .Where(i => i.ID == commentId)
                                      .FirstOrDefault();

                if (null == comment)
                {
                    return(false);
                }

                context.PostComment.Delete(comment.ID);
                context.Save();

                return(true);
            }
        }