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

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