Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Add IActionResults factory methods to Page and PageModel #5846

@rynowak

Description

@rynowak

We have support for returning IActionResult from a page or pagemodel, but we haven't yet ported over the API surface that users need.

This item tracks adding boilerplate for things we already have, not inventing new action results or factory methods which will be tracked separately.


I've done the gap analysis here between Controller/ControllerBase and Page/Page model:

TLDR here's what to do....

Add the following to Page

Challenge
Content
Forbid
File
LocalRedirect
NotFound
PhysicalFile
Redirect (missing some of the variations for preservemethod)
RedirectToAction
RedirectToRoute
SignIn
SignOut
StatusCode
Unauthorized

Add the following to PageModel

Challenge
Content
Forbid
File
LocalRedirect
NotFound
PhysicalFile
Redirect (missing some of the variations for preservemethod)
RedirectToAction
RedirectToRoute
SignIn
SignOut
StatusCode
Unauthorized


My notes...

All Methods on Controller/ControllerBase

Accepted
AcceptedAtAction
AcceptedAtRoute
BadRequest
Challenge
Content
Created
CreatedAtAction
CreatedAtRoute
File
Forbid
Json
LocalRedirect
NoContent
NotFound
Ok
PartialView
PhysicalFile
Redirect
RedirectToAction
RedirectToRoute
SignIn
SignOut
StatusCode
Unauthorized
View
ViewComponent

All of the Redirect kinds have 4 Permanent/PreserveMethod variations - I'm not going to repeat that detail everywhere 👍

Methods Pages Should Have

Challenge
Content
Forbid
File
LocalRedirect
NotFound
PhysicalFile
Redirect
RedirectToAction
RedirectToRoute
SignIn
SignOut
StatusCode
Unauthorized

Including the authorization-related stuff here because we will eventually add it if we don't today. The things that aren't added are the HTTP/API related helpers, legacy things like JSON and View-related stuff

Methods Pages Don't Need

Accepted
AcceptedAtAction
AcceptedAtRoute
BadRequest
Created
CreatedAtAction
CreatedAtRoute
Json
NoContent
Ok
PartialView
View
ViewComponent

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions