C#C
C#12mo ago
101 replies
workani

✅ Good practice question | Web Api

Is it good practice to avoid adding createdComment variable and map comment directly?

var comment = mapper.Map<Comment>(dto);
    
var createdContent = await commentRepository.AddNewCommentAsync(comment, postId);

var commentDto = mapper.Map<CommentDto>(createdContent);

return Ok(commentDto);
Was this page helpful?