Пример #1
0
        public async Task <CommentDetailsDto> Handle(CreateNewCommentCommand request, CancellationToken cancellationToken)
        {
            if (!_authService.UserRoleAdminOrTeamIdMatches(request.CommentForCreationDto.TeamId))
            {
                throw new AuthenticationException();
            }

            request.CommentForCreationDto.UserId = new Guid(_authService.GetUserIdClaimValue());

            var commentToAdd = _mapper.Map <Comment>(request.CommentForCreationDto);
            await _commentService.AddNewCommentAsync(commentToAdd);

            return(_mapper.Map <CommentDetailsDto>(commentToAdd));
        }