Scaffold Unisys Web API Controller for ePortal Data Source Dialog

Note: This topic applies to the Web API presentation project type only. Refer to Creating a RESTful Web Service Application for more information.

Scaffolding is the technique used to generate the presentation code that the application can use at run time. The generated code represents a useful starting point for your application that you may want to further modify to refine the application.

Refer to the following topics for more information:

To scaffold one or more data sources in your presentation project, do the following:

  1. Click Build and select Build Solution to build the solution.

  2. In Solution Explorer, navigate to a Web API project. If you are using areas, navigate to the correct area folder (for example Areas/<areaname>, where <areaname> is the name of your area).

    Note: An Area is a logical grouping of Controller, Models, and other related folders in a Web API application. Areas are an optional feature in Web API. For an example, refer to https://msdn.microsoft.com/en-us/library/ee671793(v=vs.100).aspx.

  3. Right-click the project or area folder and select Add, then select New Scaffolded Item.

    The Add Scaffold dialog opens.

  4. On the Add Scaffold dialog, select Unisys Web API Controller for ePortal Data Source and click Add.

    The Scaffold Unisys Web API Controller for ePortal Data Source Dialog opens.

  5. Complete the dialog as described below.

  6. After completing the dialog fields, click OK to start scaffolding.

    Note: If scaffolding would overwrite any existing files, you are given a chance to confirm before overwriting.

Dialog Fields

The dialog fields are described below:

Web Method Return

Scaffolded web methods have a return type of System.Web.Http.IHttpActionResult which allows explicit return of HTTP Response Codes.

Response codes returned include OK (200), Bad Request (400), Internal Server Error (500), and Not Implemented (501).

Each web method includes the following method attributes:

Other response codes, if returned, do not contain predefined response type.

Verbs

When scaffolding for the Verb is “Delete”, the method returns a result of NotImplemented (code 501) with no data. You can modify or override the method to perform the desired action, if required.

Attribute Routing

If attribute routing is used with parameters embedded in the URI, the parameters are matched by name and applied to the model for the matched results. Additionally, the parameter attribute [FromUri] is added to the parameter list.

Extending the Controller

Refer to Programming in the Controller for MVC Web for more information on extending the Controller.