public async Task CreatePostAsync(SavePostModel savePostModel) { ArgumentGuard.NotNull(savePostModel, nameof(savePostModel)); // permission await _postService.CreatePostAsync(savePostModel); }
public async Task UpdatePostAsync(SavePostModel model, Guid postId) { var updatePostModel = new UpdatePostModel { Id = postId, Content = model.Content, Status = model.Status, Tags = model.Tags, Title = model.Title }; await _postManager.UpdatePostAsync(updatePostModel); }
public async Task CreatePostAsync(SavePostModel savePostModel) { ArgumentGuard.NotNull(savePostModel, nameof(savePostModel)); await _validatorfactory.ValidateAsync(savePostModel); var post = new PostEntity { Id = Guid.NewGuid(), Title = savePostModel.Title, Content = savePostModel.Content, Status = PostStatus.Draft, Tags = savePostModel.Tags.Select(t => new TagEntity { Id = Guid.NewGuid(), Name = t }).ToList(), CreatedDateUtc = DateTime.UtcNow, AuthorId = _userContext.UserId }; await _postRepository.AddAsync(post); }
public Task UpdatePost([FromBody] SavePostModel model, Guid postId) { return(_postComposerService.UpdatePostAsync(model, postId)); }
public async Task AddPost(SavePostModel model) { await _postManager.CreatePostAsync(model); }