Search⌘ K
AI Features

Adding the TaskItem class and API controller

Understand how to add a TaskItem class to your shared project and create an API controller with Entity Framework in the server project. This lesson guides you through integrating the data model and controller setup necessary for managing tasks in a Blazor WebAssembly application with ASP.NET Web API.

We need to add the TaskItem class. We do this as follows:

  1. Right-click the TaskManager.Shared project and select the “Add, Class” option from the menu.
  2. Name the new class TaskItem.
  3. Click the “Add” button.
  4. Make the class public by adding the public modifier:
C#
public class TaskItem
...