public void MapCommentToAddRequestToCommentEntity(CommentToAddRequest source, out Comment destination) { destination = new Comment() { PhotoId = source.PhotoId, Content = source.Content }; }
private CommentEntity MapRequestToEntity(CommentToAddRequest comment, Guid userId) { var commentEntity = new CommentEntity(); _mapper.MapCommentToAddRequestToCommentEntity(comment, out commentEntity); commentEntity.UserId = userId; return(commentEntity); }
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()); }