Exemple #1
0
        public virtual IActionResult Comments(int?filterByBlogPostId)
        {
            //try to get a blog post with the specified id
            BlogPost blogPost = _blogService.GetBlogPostById(filterByBlogPostId ?? 0);

            if (blogPost == null && filterByBlogPostId.HasValue)
            {
                return(RedirectToAction("List"));
            }

            //prepare model
            BlogCommentSearchModel model = _blogModelFactory.PrepareBlogCommentSearchModel(new BlogCommentSearchModel(), blogPost);

            return(View(model));
        }
Exemple #2
0
        public virtual IActionResult BlogComments(int?filterByBlogPostId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageBlog))
            {
                return(AccessDeniedView());
            }

            //try to get a blog post with the specified id
            var blogPost = _blogService.GetBlogPostById(filterByBlogPostId ?? 0);

            if (blogPost == null && filterByBlogPostId.HasValue)
            {
                return(RedirectToAction("BlogComments"));
            }

            //prepare model
            var model = _blogModelFactory.PrepareBlogCommentSearchModel(new BlogCommentSearchModel(), blogPost);

            return(View(model));
        }