1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Fixed redirect for blog posts not working right

This commit is contained in:
Uncled1023 2016-09-30 13:41:24 -07:00
parent 5040f98cf6
commit bafb11bb6d

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);