perf: structure query get a bit better
This commit is contained in:
parent
56a8ba7368
commit
983e636635
@ -39,22 +39,12 @@ public class Index : PageModel
|
|||||||
public IActionResult OnGet([FromQuery(Name = "pid")] int? postId = null,
|
public IActionResult OnGet([FromQuery(Name = "pid")] int? postId = null,
|
||||||
[FromQuery(Name = "p")] int? wpPostId = null)
|
[FromQuery(Name = "p")] int? wpPostId = null)
|
||||||
{
|
{
|
||||||
if (!(postId.HasValue ^ wpPostId.HasValue))
|
if (postId.HasValue == wpPostId.HasValue)
|
||||||
{
|
{
|
||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wpPostId.HasValue)
|
return postId.HasValue ? HandleNewRoute(postId.Value) : HandleWordPressRoute(wpPostId!.Value);
|
||||||
{
|
|
||||||
return HandleWordPressRoute(wpPostId.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (postId.HasValue)
|
|
||||||
{
|
|
||||||
return HandleNewRoute(postId.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new UnreachableException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IActionResult HandleNewRoute(int postId)
|
private IActionResult HandleNewRoute(int postId)
|
||||||
|
Loading…
Reference in New Issue
Block a user