code quality ?
This commit is contained in:
parent
4e92afb496
commit
1bd9c00cd8
1 changed files with 3 additions and 2 deletions
|
|
@ -73,10 +73,11 @@ public class PermissionHandler : IAuthorizationHandler
|
||||||
"/Blogspot/Delete",
|
"/Blogspot/Delete",
|
||||||
StringComparison.OrdinalIgnoreCase))
|
StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
string postId = (string) httpContext.GetRouteValue("id");
|
string? postId = (string?) httpContext.GetRouteValue("id");
|
||||||
if (long.TryParse(postId, out long id))
|
if (long.TryParse(postId, out long id))
|
||||||
{
|
{
|
||||||
BlogPost b = applicationDbContext.BlogSpot.FirstOrDefault(b => b.Id == id && b.AuthorId == user.GetUserId());
|
BlogPost? b = applicationDbContext.BlogSpot.FirstOrDefault
|
||||||
|
(b => b.Id == id && b.AuthorId == user.GetUserId());
|
||||||
return b != null;
|
return b != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue