public ActionResult DeleteTag(int id, DeletePostTagViewModel vm) { foreach (int selectedPostTag in vm.selectedPostTags) { _postRepository.RemovePostTag(selectedPostTag); } var thePost = _postRepository.GetPublishedPostById(id); return(RedirectToAction("Details", new { thePost.Id })); }
public ActionResult DeleteTag(int id) { List <PostTag> postTags = _postRepository.GetAllPostTagsByPostId(id); List <int> selectedPostTags = new List <int>(); var vm = new DeletePostTagViewModel() { Post = _postRepository.GetPublishedPostById(id), postTags = postTags, selectedPostTags = new List <int>() }; return(View(vm)); }