BusyBooking by winsmith

Samples

Learning pages for Razor Pages and htmx. This area only exists in Development; in any other environment its routes are removed (see Program.cs).

How a Razor Page is put together

  • The page (Basics.cshtml): HTML plus Razor. @page makes it reachable at a URL, here /Samples/Basics, from its area and file name.
  • The page model (Basics.cshtml.cs): a C# class with handler methods. OnGet runs for a GET, OnPost for a form POST, and OnGetSearch / OnPostGreet are named handlers, selected with ?handler=Search.
  • Partials (_SearchResults.cshtml): reusable HTML fragments. Files starting with _ have no URL of their own.
  • Tag helpers such as asp-for and asp-page generate the right names, ids, links and validation markup from your C# model.
  • Everything written with @ is HTML-encoded automatically, which protects against cross-site scripting.

Razor Pages basics

A classic form: model binding, validation, and Post/Redirect/Get. No JavaScript.

Map

The hotline map's spike: Azure Maps and its drawing tools under the map pages' policy, signed in with a token from our server. Needs Maps__Azure__ClientId and az login.

htmx samples

The same page model ideas, but parts of the page update themselves through htmx attributes: load on click, live search, a form posted without a page reload, and polling.