コード例 #1
0
        /// <summary>
        /// コメントを登録する
        /// </summary>
        /// <param name="comment"></param>
        /// <param name="clientIp"></param>
        /// <returns></returns>
        public bool AddComment(CommentPostViewModel postedComment, string clientIp)
        {
            Comment comment = new Comment();

            comment.InjectFrom(postedComment);

            comment.AddedBy    = HttpUtility.HtmlEncode(comment.AddedBy);
            comment.AddedByWeb = HttpUtility.HtmlEncode(comment.AddedByWeb);
            comment.AddedByIP  = clientIp;
            comment.Body       = HttpUtility.HtmlEncode(comment.Body);

            comment.UpdatedBy   = comment.AddedBy;
            comment.AddedDate   = DateTime.Now;
            comment.UpdatedDate = DateTime.Now;

            _repository.AddComment(comment);
            return(_repository.SaveChanges() == 1);
        }
コード例 #2
0
 public void Create(CommentEntity comment)
 {
     contentRepository.AddComment(comment.ToDalComment());
     uow.Commit();
 }