A PageModel property stores data that a Razor Page displays. Expose view-specific data as public properties on the PageModel, then assign values in the page handler. section 17.2.3
A task list PageModel
A PageModel can expose different kinds of data: a string for the title and a list for tasks. The OnGet handler assigns both before the view renders.
Choose other mechanisms when their specific purpose fits better:
- Use ViewData for arbitrary keyed data or values needed by layout files. section 17.2.3
- Use TempData for data that must survive until it is read during another request, commonly with POST-Redirect-GET. section 17.2.3
