Ejemplo n.º 1
0
        /// <summary>
        /// Prepare blog comment model
        /// </summary>
        /// <param name="blogComment">Blog comment entity</param>
        /// <returns>Blog comment dto</returns>
        public virtual BlogCommentDto PrepareBlogPostCommentModel(BlogComment blogComment)
        {
            if (blogComment == null)
            {
                throw new ArgumentNullException(nameof(blogComment));
            }

            var user = _userService.GetUserById(blogComment.CustomerId);

            var blogCommentDto = blogComment.ToDto <BlogCommentDto>();

            blogCommentDto.CustomerName         = user?.Firstname + " " + user?.Lastname;
            blogCommentDto.CustomerAvatarUrl    = user?.ProfileUrl;
            blogCommentDto.AllowViewingProfiles = false;
            blogCommentDto.CreatedOn            = _dateTimeHelper.ConvertToUserTime(blogComment.CreatedOnUtc, DateTimeKind.Utc).ToString("g"); //TODO: Can be changed according to need

            return(blogCommentDto);
        }