Anonymous posts list and individual blog post

The anonymous posts list and individual blog post View feature could be added to the system by performing the following steps:

  1. Change the current posts listing route to admin route.
  2. Change the current display post route to admin route as well.

 

  1. Create an IGetPaginatedPostQuery query object interface.
  2. Create a GetPaginatedPostQuery concrete query object.
  3. Create an action to list blogs anonymously, GetPostsBlogHome().
  4. Create an action to display blog anonymously, Display().
  5. Create a layout exclusively for a blog, since most of the sites have different layouts between landing pages and blogs.
  6. Create a view, GetPostsBlogHome.cshtml, under the Posts View folder.
  7. Create a view, Display.cshtml, under the Posts View folder as well.
  8. Provide an appropriate hyperlink and its updates.

The preceding listed implementation is performed and available in the following Git repository commit:

https://goo.gl/VPVJBg

We have to show the posts to the anonymous users and let only authorized users see the administrator view of editing posts. In order to achieve this functionality, we have modified the route of the posts controller to wrap inside Admin, and the anonymous post listing was moved to the root (the tilde ~ symbol is used to redefine the API route) using attribute routing, as shown in the following screenshot:

The anonymous post listing view would consume the preceding listed action, which would be rendered, as shown in the following screenshot, in the highlighted configured ~/blog route:

We have seen the changes required to include the anonymous posts list, and similar changes required for displaying an individual blog post are also available in the same repository commit page. In the next section, let's focus on how comments are listed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset