code quality ?

This commit is contained in:
Paul Schneider 2025-10-05 20:36:18 +01:00
commit 1bd9c00cd8

View file

@ -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;
} }
} }