Browse Source

Fixed redirect for blog posts not working right

tags/2.0.3
Teknikode 4 years ago
parent
commit
bafb11bb6d
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      Teknik/Areas/Blog/Controllers/BlogController.cs

+ 1
- 2
Teknik/Areas/Blog/Controllers/BlogController.cs View File

@@ -88,8 +88,7 @@ namespace Teknik.Areas.Blog.Controllers
PostViewModel model = new PostViewModel();
// find the post specified
bool isAuth = User.IsInRole("Admin");
var post = db.BlogPosts.Where(p => (p.Blog.User.Username == username && p.BlogPostId == id) &&
(p.Published || p.Blog.User.Username == User.Identity.Name || isAuth)).FirstOrDefault();
var post = db.BlogPosts.Where(p => p.BlogPostId == id && (p.Published || p.Blog.User.Username == User.Identity.Name || isAuth)).FirstOrDefault();
if (post != null)
{
model = new PostViewModel(post);

Loading…
Cancel
Save