コード例 #1
0
        public IResult AddComment(int articleId, int developerId, string commentContent)
        {
            try
            {
                Comment comment = new Comment
                {
                    ArticleId      = articleId,
                    WriterId       = developerId,
                    CommentContent = commentContent,
                    ModifiedDate   = DateTime.Now,
                    CreatedDate    = DateTime.Now,
                };

                DbInstance.AddComment(comment);
                DbInstance.SaveChanges();
                return(new SuccessResult());
            }
            catch (Exception)
            {
                return(new ErrorResult(Messages.ErrorAddComment));
            }
        }