Exercise: Get Tags

Everything that we've done has brought us to this point. Today, right here, right now you're about to code the Tags Repository Interface, Implement the Interface in the Tags Repository class and write the code in the Tags Controller to send back an array of Tags to the client.

There's nothing to be afraid of, nothing to be shy about… you can do this. You have plenty of code to review and copy from. I've provided some hints to where you can specifically look in code for certain examples.

Give it your best shot before reviewing the solution I came up with.

In the Conduit.Repository Project:

Add ITagsRepository.cs file

Method Signature: string[] GetTags();

Add TagRepository.cs file


  • ConduitContext
  • Ilogger

Implement ITagsRepository Interface

  • Hint: ArticleRepository.ArticleMapper – Check out how Tags are being converted to an array.

In the Conduit.Api Project:

Edit TagsController.cs file
  • Inject ITagsRepository
  • Create GetTagsAsync Method
    • HttpGet
  • Implement Basic Exception Handling code
  • Get Tags from ITagsRepository.GetTags() Method
  • Return OK Response with Tags Array Object

I finished! On to the next chapter