title: ASP.NET CORE RAZOR PAGES - Overload method
body: <p>I have been stuck with two problems in ASP.NET CORE RAZOR PAGES and I didn't find any content about it.</p>
  
  <p><strong>Problem 1:</strong> I have been trying to do an overload on my page component, but it looks like it's not possible, to make it works, I'm, using a nullable parameter on my method, but I do not know if this is the best way to do it, there's a better way?</p>
  
  <p>What I have working:</p>
  
  <p><em>// For New Item or Edit Item</em></p>
  
  <p><strong>public IActionResult OnGetModal(int? squid)</strong></p>
  
  <p>What I wanted:</p>
  
  <p><em>// For new Item</em></p>
  
  <p><strong>public IActionResult OnGetModal()</strong></p>
  
  <p><em>// For Edit Mode</em></p>
  
  <p><strong>public IActionResult OnGetModal(int squid)</strong></p>
  
  <p><strong>NOTE:</strong> If instead this unique method with a nullable parameter, I use two methods 1 method without parameter and another method with this int parameter, I got an error because I have multiple handlers.</p>
  
  <hr>
  
  <p><strong>Problem 2:</strong> I have 2 methods with the same parameter name, and I got an error when I try to refer to this handler.</p>
  
  <p>Method 1: </p>
  
  <p><strong>public IActionResult OnGetModal(int? squid)</strong></p>
  
  <p>Method 2:</p>
  
  <p><strong>public bool OnPostActivateDeactivate(int squid, bool isActive)</strong></p>
  
  <p><em>Here I'm trying to access the method Modal:</em></p>
  
  <p><strong>URL: ?handler=modal&amp;squid=1001</strong></p>
  
  <p>Error: InvalidOperationException: Unsupported handler method return type 'System.Boolean'.</p>
  
  <p>How do I solve these problems or what would be the best way to do it?</p>