From the course: Azure Microservices with .NET Core for Developers

Unlock the full course today

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

Obtaining a single product in the products microservice

Obtaining a single product in the products microservice - Azure Tutorial

From the course: Azure Microservices with .NET Core for Developers

Start my 1-month free trial

Obtaining a single product in the products microservice

- [Instructor] So far, we've built a fully functional controller that returns the whole products catalog from the in-memory database. In addition to this end point, we're going to implement another one that returns a single product. Let's see how we can do this. The first thing that I want to do is to implement this public async Task of type IActionResult. GetProductAsync method. Mapped to the Get verb here in the controller as well. But in this time we're going to ask for this ID parameter. So, in this attribute I'm going to use this template. So, the routing can know that it should map this ID to this parameter. Next, we have to change the IProductsProvider interface. Let's open Solution Explorer and let's go back to the IProductsProvider interface. And let's close this. We're going to implement something very similar. But in this time I'm going to return just a single product. The name of this item will be Product.…

Contents