Beispiel #1
0
 public void MapCommentToAddRequestToCommentEntity(CommentToAddRequest source, out Comment destination)
 {
     destination = new Comment()
     {
         PhotoId = source.PhotoId,
         Content = source.Content
     };
 }
Beispiel #2
0
        private CommentEntity MapRequestToEntity(CommentToAddRequest comment, Guid userId)
        {
            var commentEntity = new CommentEntity();

            _mapper.MapCommentToAddRequestToCommentEntity(comment, out commentEntity);

            commentEntity.UserId = userId;

            return(commentEntity);
        }
Beispiel #3
0
        public async Task <IActionResult> AddComment([FromBody] CommentToAddRequest comment, CancellationToken cancellationToken)
        {
            var identifier = User.GetUserId();

            var command = new AddCommentCommand
            {
                Comment      = comment,
                LoggedUserId = identifier
            };

            await _mediator.Send(command);

            return(NoContent());
        }