From the course: Building React and ASP.NET Core Applications

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Creating data models

Creating data models

From the course: Building React and ASP.NET Core Applications

Start my 1-month free trial

Creating data models

- [Narrator] To work with our data, we are going to create a data model. So, let's go to visual code and see this in action. In here, let us create a new folder. We are going to name this folder, "Data," because inside here, we are going to put all the data-related files like the model, services, et cetera. Now inside the "Data" folder, let's create another one named, "Models." Inside the "Models" folder, we are going to create a new file named, "Trip.cs" because we are creating an app to manage our trips. So, let us now define the namespace in here so for that, we write, "namespace Trips.Data" so "public class Trip." To identify the trips, we need an identifier. So, for that, write in here, "prop" then double tab. Let us give the integer data type and then name this property, "Id." Then each trip has a name. So, write in your prop, change the type to, "string," and name the property, "Name." Let's create another…

Contents