public async Task <PostDTO> Handle( CreateNewPost request, CancellationToken cancellationToken) { var post = new Infrastructure.Models.Post() { Name = request.Name, Content = request.Content, CommunityId = request.CommunityId, CreationDate = DateTime.Now, CreatorUserId = (Guid)request.UserId }; _context.Posts.Add(post); await _context.SaveChangesAsync(cancellationToken); AddTagsToPost(request.Tags, post.Id); return(_mapper.Map <Infrastructure.Models.Post, PostDTO>(post)); }
public static Domain.Post ToDomain(this Infrastructure.Models.Post post) { return(new Post(post.Id, post.Message, post.UserId, post.Timestamp)); }