Delete blogspot articles
This commit is contained in:
parent
b8446682e6
commit
4e92afb496
2 changed files with 10 additions and 49 deletions
|
|
@ -69,14 +69,15 @@ public class PermissionHandler : IAuthorizationHandler
|
|||
else
|
||||
if (resource is DefaultHttpContext httpContext)
|
||||
{
|
||||
if (httpContext.Request.Path.StartsWithSegments("/blogpost/Delete", StringComparison.OrdinalIgnoreCase))
|
||||
if (httpContext.Request.Path.StartsWithSegments(
|
||||
"/Blogspot/Delete",
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string postId = (string)httpContext.GetRouteValue("id");
|
||||
string postId = (string) httpContext.GetRouteValue("id");
|
||||
if (long.TryParse(postId, out long id))
|
||||
{
|
||||
BlogPost b = applicationDbContext.BlogSpot.FirstOrDefault(b => b.Id == id && b.AuthorId == user.GetUserId());
|
||||
return b != null;
|
||||
|
||||
BlogPost b = applicationDbContext.BlogSpot.FirstOrDefault(b => b.Id == id && b.AuthorId == user.GetUserId());
|
||||
return b != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue