// GET: PostTagController/Delete/5 public ActionResult Delete(int id) { { IEnumerable <PostTag> postTags = _postTagRepository.GetAllPostTagsByPostId(id); List <int> postTagsSelected = new List <int>(); Post post = _postRepository.GetPublishedPostById(id); //creating an instance of the view model class PostTagFormViewModel vm = new PostTagFormViewModel() { PostTag = new PostTag(), PostTagsSelected = postTagsSelected, PostId = id, PostTags = postTags }; if (post.UserProfileId == int.Parse(User.Claims.ElementAt(0).Value)) { return(View(vm)); } else { return(NotFound()); } } }
public IActionResult GetAllPostTagsByPostId(int postId) { var tags = _postTagRepository.GetAllPostTagsByPostId(postId); if (tags == null) { return(NotFound()); } return(Ok(tags)); }
public IActionResult Details(int id) { var post = new Post(); post = _postRepository.GetPublishedPostById(id); if (post == null) { return(NotFound()); } else { post.TagNames = _postTagRepository.GetAllPostTagsByPostId(id); return(View(post)); } }
public IActionResult GetAllPostTagsByPost(int id) { return(Ok(_postTagRepository.GetAllPostTagsByPostId(id))); }