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

Unlock the full course today

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

Creating mock services

Creating mock services

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

Start my 1-month free trial

Creating mock services

- [Instructor] To work with data we are going to create a service. And after we create the service, we are going to inject the service so we are able to use it. So, let's go to Visual code and see this in action. In here go inside the data folder and create a new folder. We are going to name this folder services. Then next, let us create our service interface. This is going to be named I Trip Service dot cs. Let us know define the namespace. So the namespace is going to be namespace trips dot data. Now write public interface, I Trip Service. In here we are going to define all the methods that going to use. First of all we need a method that we are going to use to get a list of all trips. So for that we write in here, a list of trip is going to be the response. And the name is going to be Get All Trips. Let's import the list namespace, which is the system dot collections dot generic. And now let's create another method,…

Contents