How can I add custom pages to the source code? I'm used to Blazor, where I would add a CustomPage.razor file, and add routing with:
Then add cshtml in the same file with C# code within a code block with:
<h3>Custom Page </h3>
<EditForm Model="RequestObject" OnValidSubmit="@GetResponse">
<input @bind-value="RequestObject.RequestProperty"></input>
<button type="submit">Submit</button>
</EditForm>
<div>Result: @result</div>
@code{
[inject]
private IMyClient APIClient
private string result = "";
private async Task<string> GetResponse(RequestObject requestObject) => APIClient.SendRequest(requestObject);
}
I'm confused by the source code cshtml files with '@page "{t:int}/{handler?}"' and the '@model EmailTopicModel'
My questions:
1. What is the {handler?} part of the route? Can I just route with @page "/CustomPage"?
2. Do I put my C# in a Model class and reference that from the page file or can I use a @code{} block?
3. How do I pass data between the backend and frontend code to and from API calls?
Any help or resources would be much appreciated!