From the course: Building Angular and ASP.NET Web API Apps

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Create the read by ID API endpoint

Create the read by ID API endpoint

- [Instructor] Now in this part we're going to set up another API Endpoint and this API Endpoint is going to be used to get the details of a single transaction. We need this when we want to, for example, update a transaction because we click the Edit button, the transaction is loaded from the database, we fill in the form, then we update the data and we just send them back to the database. So in this part we're going to create an API Endpoint, which is going to be able to handle HttpGet requests from the Angular app, but as a parameter is going to also have the ID of the transaction. So I basically use the ID to gather data from the database. To create this API, let us go to Visual Studio. In Visual Studio in the same controller, I'm going to create another HttpGet action. So for that, just HttpGet. But this is going to also take as a parameter an id, so inside double quotes then curly brackets, I'm just going to define the id value. Then down here the same way we are going to have a…

Contents