Adding the API Controllers

Learn how to add API controllers to our Blazor WebAssembly app.

We'll cover the following

We need to add an API controller for each of the new classes. We do this as follows:

  1. Right-click the ExpenseTracker.Server.Contollers folder and select the “Add, Controller” option from the menu.

  2. Select the “API Controller with actions, using Entity Framework” option.

  3. Click the “Add” button.

  4. Set Model class to ExpenseType (ExpenseTracker.Shared).

  5. Click the “Add data context” button to open the “Add Data Context” dialog:

Get hands-on with 1200+ tech skills courses.