示例#1
0
        public virtual async Task <IActionResult> BlogComments(int?filterByBlogPostId)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageBlog))
            {
                return(AccessDeniedView());
            }

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

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

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

            return(View(model));
        }