displays hidden posts to owner
This commit is contained in:
parent
04fe8c7dfa
commit
1740fb80b5
1 changed files with 7 additions and 3 deletions
|
|
@ -39,13 +39,17 @@ namespace Yavsc.Controllers
|
||||||
|
|
||||||
// GET: Blog
|
// GET: Blog
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult Index(string id)
|
public IActionResult Index(string id, int skip=0, int maxLen=25)
|
||||||
{
|
{
|
||||||
|
string uid = null;
|
||||||
|
if (User.IsSignedIn())
|
||||||
|
uid = User.GetUserId();
|
||||||
if (!string.IsNullOrEmpty(id))
|
if (!string.IsNullOrEmpty(id))
|
||||||
return UserPosts(id);
|
return UserPosts(id);
|
||||||
return View(_context.Blogspot.Include(
|
return View(_context.Blogspot.Include(
|
||||||
b => b.Author
|
b => b.Author
|
||||||
).Where(p => p.Visible).Take(10));
|
).Where(p => p.Visible || p.AuthorId == uid ).OrderByDescending(p => p.Posted)
|
||||||
|
.Skip(skip).Take(maxLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Title/{id?}")]
|
[Route("/Title/{id?}")]
|
||||||
|
|
@ -116,7 +120,7 @@ namespace Yavsc.Controllers
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
_logger.LogWarning("Invalid Blog posted ...");
|
ModelState.AddModelError("Unknown","Invalid Blog posted ...");
|
||||||
return View(blog);
|
return View(blog);
|
||||||
}
|
}
|
||||||
[Authorize()]
|
[Authorize()]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue