Beispiel #1
0
        public async Task CreatePostAsync(SavePostModel savePostModel)
        {
            ArgumentGuard.NotNull(savePostModel, nameof(savePostModel));

            // permission
            await _postService.CreatePostAsync(savePostModel);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public Task UpdatePost([FromBody] SavePostModel model, Guid postId)
 {
     return(_postComposerService.UpdatePostAsync(model, postId));
 }
Beispiel #5
0
 public async Task AddPost(SavePostModel model)
 {
     await _postManager.CreatePostAsync(model);
 }