Example #1
0
        public IActionResult OnGet(string postName)
        {
            BlogPost = _blogPostRepository.FindPostByFileName(postName.ToLower());
            if (BlogPost == null)
            {
                return(RedirectToPage("/LostAndNotFound"));
            }

            var handler = _serviceProvider.GetService <IncrementViewsHandler>();

            (handler as IncrementViewsHandler)?
            .Handle(new IncrementViewsHandlerRequest());

            NextPostFileName = _blogPostRepository.FindNextPostFileName(BlogPost.Created);
            PrevPostFileName = _blogPostRepository.FindPrevPostFileName(BlogPost.Created);

            return(Page());
        }