public async Task <IActionResult> PublishToggle(Guid postId) { var post = await postRepository.GetById(postId); post.IsPublished = !post.IsPublished; await postRepository.Update(post); return(Ok()); }
public async Task <ActionResult> Get(Guid id) { var post = await repository.GetById(id); if (post == null) { return(NotFound()); } return(View("Post", new PostViewModel(post))); }