예제 #1
0
        public async Task <IActionResult> PublishToggle(Guid postId)
        {
            var post = await postRepository.GetById(postId);

            post.IsPublished = !post.IsPublished;
            await postRepository.Update(post);

            return(Ok());
        }
예제 #2
0
        public async Task <ActionResult> Get(Guid id)
        {
            var post = await repository.GetById(id);

            if (post == null)
            {
                return(NotFound());
            }

            return(View("Post", new PostViewModel(post)));
        }